Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > Siebel eScript Statements > if StatementThe if statement tests a condition and proceeds depending on the result. Syntax ASyntax Bif (condition) UsageThe if statement is the most commonly used mechanism for making decisions in a program. When multiple statements are required, use the block version (Syntax B) of the if statement. When expression is true, the statement or statement_block following it is executed. Otherwise, it is skipped. The following fragment is an example of an if statement: if ( i < 10 ) Note that the brackets are not required if only a single statement is to be executed if condition is true. You may use them for clarity. The else statement is an extension of the if statement. It allows you to tell your program to do something else if the condition in the if statement was found to be false. In Siebel eScript code, the else statement looks like this, if only one action is to be taken in either circumstance: if ( i < 10 ) If you want more than one statement to be executed for any of the alternatives, you must group the statements with brackets, like this: if ( i < 10 ) To make more complex decisions, an else clause can be combined with an if statement to match one of a number of possible conditions. ExampleThe following fragment illustrates using else with if. For another example, read setTime() Method. if ( i < 10 ) See Also |
Siebel eScript Language Reference |