Function函数
函数实际是实现一种映射,它通过一定的映射规则,完成运算并返回结果。参数传递也两种:按值传递(ByVal)和按地址传递(ByRef)。如下例:
Function password(ByVal x as integer, byref y as integer) as boolean
If y=100 then y=x+y else y=x-y
x=x+100
if y=150 then password=true else password=false
End Function
Sub call_password ()
Dim x1 as integer
Dim y1 as integer
x1=12
y1=100
if password then ‘调用函数:1. 作为一个表达式放在=右端 ; 2. 作为参数使用
debug.print x1
end if
End sub