Select : EndSelect
Select <expression1>
Case <expression> [, <expression> [<numeric expression> To <numeric expression>]]
...
[Case <expression>]
...
[Default]
...
EndSelect
DescriptionSelect 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 (numeric values only). If none of the Case values are true, then the Default code will be executed (if specified).
Note: Select will accept floats as <expression1> but will round them down to the nearest integer (comparisons will be done only with integer values).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