vbs过程参数--byref和byval

vbs过程参数--byref(默认)和byval

请看例子:

On error resume Next



Sub A1(byval s)

    s = s & "125"

End Sub



Function A2(byval s)

    s = s & "125"

    A2 = s

End Function



Dim p1, p2, p3

p1 = "what1"

p2 = "what2"

A1 p1

p3 = A2(p2)

MsgBox p1 & " : " & p2 & " : " & p3



'结论:byval: 传值,byref: 传引用

你可能感兴趣的:(val)