Function
getResult(ByVal x As Byte, ByVal y As Byte) As Byte
getResult = x + y
End Function
Sub Test()
Dim res
As Byte
res =
getResult(5,10)
MsgBox
(res)
End Sub
二、返回值为多个值的Funtion,使用数组保存返回值,例如:
Function
getResult(ByVal x As Byte, ByVal y As Byte) As Byte()
Dim
tmpRes(1 To 2) As Byte
tmpRes(1)
= x + y
tmpRes(2)
= x * y
getResult
= tmpRes()
End Function
Sub Test()
Dim arr(1
To 2) As Byte
res =
getResult(5, 10)
End Sub
加载中,请稍候......