Select Case

Top  Previous  Next

Select Case - Checking Muliple Variable Conditions

Language: VBScript

Description
The Select Case function is used to check whether the content of a single variable is equal to multiple values.

The Select Case function is limited to checking that a variable is equal to something. For more powerful expression based comparison, the If...Then...ElseIf function should be used.

Example

strName = "John"
 
Select Case strName

Case "Michael"

SMEvent.Raise "Trace", "The name is Michael"

 

Case "Fred"

SMEvent.Raise "Trace", "The name is Fred"

 

Case "John"

SMEvent.Raise "Trace", "The name is John"

 

Case Else

SMEvent.Raise "Trace", "Name not found"

End Select