Back to index
Select test_expression [ Case expression_list [ statements ] ] [ Case Else [ else_statements ] ] End Select
1. If test_expression matches any Case expression_list clause,
the statements following that Case statement are executed up to the
next Case statement or the End Select statement. Control then passes to
the statement following End Select.
2. If test_expression matches an expression_list clause in more than one Case clause, only the statements following the first match are executed.
3. The Case Else statement is used to introduce the else_statements to be executed if no match is found between the test_expression and an expression_list clause in any of the other Case statements. Although not required, it is a good idea to have a Case Else statement in your Select Case block to handle unforeseen test_expression values. If no Case expression_list clause matches testexpression and there is no Case Else statement, execution continues at the statement following End Select.
4. You can use multiple expressions or ranges in each Case clause. For example, the following line is valid:
Case 1 To 4, 7 To 9, 11, 13, > 100
5. You also can specify ranges and multiple expressions for character strings. In the following example, Case matches strings that are exactly equal to "apples", strings with values between "nuts" and "soup" in alphabetical order, and the current value of TestItem:
Case "apples", "nuts" To "soup", TestItem
6. Select Case statements can be nested. Each nested Select Case statement must have a matching End Select statement.
Input "Please enter stock price change",Stock_change Select Stock_change Case <= 0.5 Print "Don't sell yet." Case < 1.0 Print "Possible to sell." Case 1 to 3, 4 Print "Sell today." Case Else 'more then 4 Print "Sell NOW!" End Select
Copyright (c) 2000-2005 by SymbianWare OHG. All rights reserved.
SymbianWare and SymbianWare logo are trademarks of SymbianWare OHG.