Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > Operators in Siebel eScript > Logical Operators and Conditional Expressions in Siebel eScriptLogical operators compare two values and evaluate whether the resulting expression is false or true. A variable or any other expression may be false or true. An expression that performs a comparison is called a conditional expression. Logical operators are used to make decisions about which statements in a script are executed, based on how a conditional expression evaluates. The logical operators available in Siebel eScript are described in Table 10 For example, if you were designing a simple guessing game, you might instruct the computer to select a number between 1 and 100, and you would try to guess what it is. The computer tells you whether you are right and whether your guess is higher or lower than the target number. This procedure uses the if statement, which is introduced in the next section. If the conditional expression in the parenthesis following an The script implementing this simple guessing game might have a structure similar to the one that follows, in which GetTheGuess() is a function that obtains your guess. var guess = GetTheGuess(); //get the user input, either 1, 2, or 3 This example is simple, but it illustrates how logical operators can be used to make decisions in Siebel eScript. CAUTION: Remember that the assignment operator, =, is different from the equality operator, ==. If you use the assignment operator when you want to test for equality, your script fails because the Siebel eScript interpreter cannot differentiate between operators by context. Using the assignment operator incorrectly is a common mistake, even among experienced programmers. |
Siebel eScript Language Reference |