Select...Send Statement

Executes one of several groups of statements, depending on the value of an expression.

Syntax
Select selectExpr Case caseExpr statements [Case caseExpr statements ] [Default statements ] Send

Parameters

selectExpr
Specify a numeric or string expression.
caseExpr
Specifies a numeric value or string expression of the type matching the expression.
statements
Specifies one or more valid SPEL+ statements or multi-statements.

Description
If any one caseExpr is equivalent to selectExpr, then the statements after the Case statement are executed. After execution, program control transfers to the statement following the Send statement.

If no caseExpr is equivalent to selectExpr, the Default statements are executed and program control transfers to the statement following the Send statement.

If no caseExpr is equivalent to selectExpr and Default is omitted, nothing is executed and program control transfers to the statement immediately following the Send statement.

selectExpr may include constants, variables, and logical operators that use And, Or and Xor. caseExpr also may include constants, variables, and logical operators that use And, Or and Xor. In this case, the calculation result of caseExpr is compared to that of selectExpr and do not specify the variable in caseExpr because the motion becomes complicated.

See Also
If...Then...Else

Select…Send Statement Example
Shown below is a simple example for Select...Send:

Function Main
  Integer I
  For i = 0 To 10
    Select I
      Case 0
           Off 1;On 2;Jump P1
      Case 3
           On 1;Off 2
           Jump P2;Move P3;On 3
      Case 7
           On 4
      Default
           On 7
    Send
  Next
Fend