找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 6438|回复: 2

Global code in WSH

[复制链接]

96

主题

158

回帖

4

精华

核心会员

积分
6513
发表于 2012-6-6 07:53:12 | 显示全部楼层 |阅读模式
' 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

7

主题

414

回帖

1

精华

铂金会员

积分
2173
发表于 2013-4-12 22:58:36 | 显示全部楼层
有趣的排列

0

主题

68

回帖

0

精华

铜牌会员

积分
94
发表于 2015-1-11 14:18:01 | 显示全部楼层
谢谢分享
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表