您的位置:IT教程网首页>软件开发教程>VB教程>VB超频快餐,让我一次用个够!(一)

VB超频快餐,让我一次用个够!(一)


res = arr(LBound(arr))

For i = LBound(arr) 1 To UBound(arr)

If arr(i) > res Then res = arr(i)

Next

Max = res

End Function

去掉res变量,使用函数名称本身这个局部变量,可以使程序更加简练:

Function Max(arr() As Long) As Long

Dim i As Long

Max = arr(LBound(arr))

For i = LBound(arr) 1 To UBound(arr)

If arr(i) > Max Then Max = arr(i)

Next

End Function

共2页: 上一页 [1] 2 下一页