Documentation (c) 2006-2008 Hobby-Robotics, LLC


Select Case statement

Syntax:

Select Case expression

Caseexpression_list1

...

Caseexpression_listN

...

End Select

Select Case expression

Caseexpression_list1

...

Caseexpression_listN

...

Case Else

...

End Select

Description:

expression

Expression used for selecting Case

expression_list1

Coma delimited list of expressions for the first Case

expression_listN

Coma delimited list of expressions for the Nth Case

...

0 or more valid statements

Flow control statement, executes statements selected from predefined cases.

Selection is based on the current value of the expression. At runtime expression is evaluated once and its value is used to find matching Case using expression_list for each case.

If match is found in the expression_list then statements between this and next Case and are executed.

If no matching Case is found behavior depends whether Case Else is included in the list of cases.

If it is not included then Select Case is skipped, no statements are executed.

If it is included then statements between Case Else end End Select are executed.

Case Else must be the last Case.