程序点滴jcodeer.blog.chinaunix.net
jcodeer
全部博文(171)
2012年(2)
2011年(70)
2010年(9)
2009年(14)
2008年(76)
Bean_lee
GY123456
armlife
linky521
g_progra
猥琐才是
athzhang
CU博客助
meiyang_
heq76
gaokeke1
yangyefe
yanganni
tomcodin
qhy95020
allaxin
suntao32
13661379
分类:
2008-05-10 19:11:19
'''本教程讲解了VBSciprt的循环控制语句的用法''' '1.Do...Loop '打印0-9数字 intCount = 0 Do While intCount < 10 Wscript.echo intCount intCount = intCount + 1 Loop intCount = 0 Do Wscript.echo intCount intCount = intCount + 1 Loop While intCount < 10 '2.Do...Until intCount = 0 Do Until intCount = 10 Wscript.echo intCount intCount = intCount + 1 Loop 'Do...Until的另一种写法 intCount = 0 Do Wscript.echo intCount intCount = intCount + 1 Loop Until intCount = 10 '3.Exit关键字的用法 Wscript.echo "Exit usage" intCount = 0 Do Wscript.echo intCount intCount = intCount + 1 If intCount > 5 Then Exit Do Loop Until intCount = 10 '4.While...Wend用法 Wscript.echo "While...Wend" intCount = 0 While intCount < 10 Wscript.echo intCount intCount = intCount + 1 Wend '5.For...Next用法 'For的作用范围[0,10] Wscript.echo "For...Next" intCount = 0 For intCount = 0 to 10 Wscript.echo intCount Next 'For的步距修改为2 intCount = 0 For intCount = 0 to 10 step 2 Wscript.echo intCount Next '使用递减 intCount = 10 For intCount = 10 to 0 Step -1 Wscript.echo intCount Next '6.使用For Each...Next Dim dict '创建一个字典对象 Set dict = CreateObject("Scripting.Dictionary") '向字典中添加对象 dict.Add "0","Chinese" dict.Add "1","English" dict.Add "2","Janpaese" For Each item in dict Wscript.echo dict.item(item) Next
上一篇:VBScript教程之四(条件语句)
下一篇:VBScript教程之六(函数)
登录 注册