diddom 发表于 2012-6-6 07:53:12

Global code in WSH

' illustrates that all global code is executed from the beginning of a VBScript file to the end

Option 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

kk1025 发表于 2013-4-12 22:58:36

有趣的排列

sku__ 发表于 2015-1-11 14:18:01

谢谢分享
页: [1]
查看完整版本: Global code in WSH