|Bookshelf Home | Contents | Index | PDF|
The variable switch_variable is evaluated, and then it is compared to the values in the case statements (value1, value2, ..., default) until a match is found. The statement block following the matched case is executed until the end of the switch block is reached or until a break statement exits the switch block.
Make sure to use a break statement to end each case. In the following example, if the break statement after the "I=I+2;" statement were omitted, the computer executes both "I=I+2;" and "I=I+3;", because the Siebel eScript interpreter executes commands in the switch block until it encounters a break statement.
Suppose that you had a series of account numbers, each beginning with a letter that indicates the type of account. You could use a switch statement to carry out actions depending on the account type, as in the following example:
|Siebel eScript Language Reference|