Select : EndSelect
DescriptionSelect <expression1> Case <expression> [, <expression> [<expression> To <expression>]] ... [Case <expression>] ... [Default] ... EndSelect
Select allows a quick choice. The program will execute the <expression1> and keep its value in memory. It will compare this value to all of the Case <expression> values and if true it will execute the corresponding code and quit the Select structure. Case support multi-values and values range with the optional To keyword. If none of the Case values are true, then the Default code, (if specified), will be executed.Example: Simple example
Value = 2 Select Value Case 1 Debug "Value = 1" Case 2 Debug "Value = 2" Case 20 Debug "Value = 20" Default Debug "I don't know" EndSelectExample: Multicase and range example
Value = 2 Select Value Case 1, 2, 3 Debug "Value is 1, 2 or 3" Case 10 To 20, 30, 40 To 50 Debug "Value is between 10 and 20, equal to 30 or between 40 and 50" Default Debug "I don't know" EndSelect