Select Case statement (LotusScript® Language)

Selects a group of statements to execute, based on the value of an expression.


Select Case selectExpr

[ Case condList

[ statements ] ]

[ Case condList

[ statements ] ]


[ Case Else

[ statements ] ]

End Select



An expression whose value is compared with values in the subsequent condList conditions. This expression is evaluated once, and its value is used repeatedly for comparison.


Each condList is a comma-delimited list of conditions, one of which must be met for the subsequent group of statements to execute. Each condition takes one of the forms listed below, where expr is any expression:

  • expr

    Returns TRUE if selectExpr matches expr exactly. To specify multiple expressions in a single case, separate them with commas.

  • expr To expr

    Returns TRUE if the selectExpr falls inclusively within this range. The range must be specified in ascending order.

    For example, if you specify 25 To 50, the corresponding group of statements is executed when selectExpr is any value between 25 and 50, inclusive. If you specify -4 to -1, the corresponding group of statements is executed when selectExpr is any value between -4 and -1, inclusive

  • Is comparisonOp expr

    Returns TRUE when the comparison operation for selectExpr and expr is true. The comparison operator must be one of the following: = > < <> >< <= =< >= =>.

    For example, if you specify Is < 37, then the corresponding group of statements is executed when selectExpr is less than 37.


Statements to be executed if one of the governing conditions in the associated condList is the first condition to be satisfied.


The selectExpr is compared against each condition, within each condList in succession. The first time that a condition in some condList is satisfied, the group of statements associated with that condList is executed and the selection operation ends.

Either a single group of statements is executed, or no statements are executed. If you include a Case??Else group of statements, it's executed only if selectExpr fails all conditions in all condList arguments.

If selectExpr is a character and condList is a range of characters, note that the characters within the range depend on the collating sequence in effect, as specified through Option Compare. If binary comparison (Option Compare Binary) is in effect, LotusScript® uses the international Unicode character collating sequence. This is the sequence of values Uchr(0), Uchr(1), Uchr(2), .... It is the same on all LotusScript® platforms. However, if Option Compare Case, NoCase, Pitch, or NoPitch is in effect, the collating sequence order depends to some extent on the operating system that you are using. It is usually better in any case to avoid ranges for punctuation and other ambiguous characters. For better maintainability and platform-independence, specify the characters you want to match against. To specify multiple characters in a single condList, enclose them in quotes and separate them with commas. For example:

Case ":", ">", "<", "?"