Select Case / Case / End Select                                                      Statement

 

SELECT CASE varname

    CASE value1

        Statement Group 1

    CASE value2

        Statement Group 2

...

    CASE ELSE

        Statement Group n

END SELECT

 

Description

To execute specific statements based on the value of variable varname. The CASE ELSE is optional. If supplied, it specifies the statements to be executed if varname has any values except those identified in previous CASE value statements. The values in CASE statements must be variables or literals. Expressions are not allowed.

 

Example

Dim PolicyType as String

.....

Select Case PolicyType

  Case "Auto"

    CalcAutoPremium

    ShowAutoPolicy

  Case "Home"

    CalcHomePremium

    ShowHomePolicy

  Case Else

    CalcGenericPremium

    ShowGenericPolicy

End Select