Global code in WSH
' illustrates that all global code is executed from the beginning of a VBScript file to the endOption Explicit
Dim x
x = 10
Function Increment(lVar)
lVar = lVar + 1
Increment = lVar
End Function
Function Decrement(lVar)
lVar = lVar - 1
Decrement = lVar
End Function
Dim sMsg
sMsg = "The current value of x is " & x & vbCrLf
Dim y
y = 20
If x = 0 Then x = 10
sMsg = sMsg & "Value returned by Increment: " & Increment(x) & vbCrLf
sMsg = sMsg & "Value returned by Increment: " & Increment(x) & vbCrLf
sMsg = sMsg & "Value returned by Decrement: " & Decrement(x) & vbCrLf
sMsg = sMsg & "The value of x is now " & x & vbCrLf
sMsg = sMsg & "The value of y is " & y & vbCrLf
MsgBox sMsg
有趣的排列 谢谢分享
页:
[1]