Rather than using too many IF-THEN conditions to check a value and take action, you are better off using the SELECT CASE condition. It produces cleaner code and is specifically meant for multiple IF-THEN conditions.
The correct use of SELECT CASE:
Select Case strValue [strValue is the variable you want to evaluate]
Case "John"...
do someting here if strValue = "John"
Case "Paul"...
do someting here if strValue = "Paul"
Case Else... [Unlike IF-THEN-ELSE, Select Case has CASE ELSE as the "catch-all"]
do this if strValue does not = "John" or "Paul"
End Select [END SELECT ends the Select Case loop, like END IF for IF-THEN]
The correct use of SELECT CASE:
Select Case strValue [strValue is the variable you want to evaluate]
Case "John"...
do someting here if strValue = "John"
Case "Paul"...
do someting here if strValue = "Paul"
Case Else... [Unlike IF-THEN-ELSE, Select Case has CASE ELSE as the "catch-all"]
do this if strValue does not = "John" or "Paul"
End Select [END SELECT ends the Select Case loop, like END IF for IF-THEN]
Labels: Scripting

Exchangepedia Blog is read by visitors from all 50 US States and 150 countries world-wide


0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home