第一个vbscript程序

dim name ' Dim 与dim都可以
name = InputBox("请输入你的名字?")
' 注释是以单引号开头,连接字符串可以用+号或&号
MsgBox("Hello " & name + "! 很高兴认识你")
Dim age
' 不能同时声明与赋值
age = InputBox("输入你的年龄?")
' 这分支真奇葩, 还有比较相等竟然用=号没有==号
if age = "" then
   MsgBox("你还没有告诉我你几岁?")
else
' 还有一个ElseIf 总之后面跟判定的内容,最后都要跟个Then
   MsgBox("哦,你已经"& age & "岁了!")
end if
Dim count
count = 0
Do
   count = count + 1 'vbs没有++ 与+=
   MsgBox(count)
Loop While count <> 10 'vbs没有!= , != 需要改成 <> 或者 ><

你可能感兴趣的:(VBScript)