Select / Case / End Select

Execute one of several groups of statements, depending on the value of a variable.

Syntax:
Select variable
  Case value 1
     [statements 1]
  Case value 2
    [statements 2]
  Case value 3
    [statements 3]
  Case Else
    [else statements]
End Select

if variable=value1 then execute statements1
if variable=value2 then execute statements2 
if variable<>value1 and variable<>value2 then execute else statements

The Case Else block is optional.

Format Example
Literal, [literal] Case 1 or Case 1, 2, 3
Is condition literal Case Is <3
Valid conditions:
   >, <, >=, <=
literal To literal Case 3 To 10

Example:

proc4 will be called in this example

a=15
Select a
  Case 1: call proc1()
  Case 2: call proc2()
  Case 3: call proc3()
  Case 15: call proc4()
End Select
 

Also See: Exit Select