如何在VBScript中实现select语句?

时间:2009-07-14 09:59:39

标签: vbscript

有谁能告诉我如何在VBScript中实现select语句,类似于C中的switch语句?如果您提供一些示例,那将是很好的,因为我对VBScript很新。感谢。

2 个答案:

答案 0 :(得分:10)

Select Case foo
    Case 1
       MsgBox "1"
    Case 2, 3
       MsgBox "2 or 3"
    Case Else
       MsgBox "Something else"
End Select

答案 1 :(得分:0)

仅限示例

 Select Case strMyVariable
      Case "One"     Wscript.Echo "1"
      Case "Two"     Wscript.Echo "2"
      Case "Three"   Wscript.Echo "3"
      Case Else      Wscript.Echo "Wrong"
 End Select