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


Select Case statement

Select Case Expression

CaseExpression1

...

CaseExpressionN

...

End Select

This Select Case form allows to chose statements to be executed from the list of predefined cases. Selection is based on the current value of the Expression and Expression1 to ExpressionN. At runtime Expression is evaluated once and its value is used to select block of statements from the list of cases. The selection is done sequentially starting from Case Expression1 through Case ExpressionN. If comparison of current value of Expression and ExpressionX evluates to Boolean value True then block of statements for this case is executed then Select Case is exited. If current Expression evaluates to Boolean value False then next Case ExpressionX is evaluated. If no comparison evaluates to Boolean value True then no statements are executed.

Select Case Expression

CaseExpressionList1

...

CaseExpressionListN

...

Case Else

End Select

Second Select Case form introduces one change as compared to the form without the Case Else. If no comparison evaluates to Boolean value True then statements in a bock between Case Else and End Select are executed.

Wikipedia: Choice based on specific constant values