Bookshelf Home | Contents | Index | PDF |

Siebel ## Mathematical Operators in Siebel eScriptMathematical operators are used to make calculations using mathematical data. The following sections illustrate the mathematical operators in Siebel eScript. ## Basic ArithmeticThe arithmetic operators in Siebel eScript are standard. The following examples use variables and arithmetic operators: var i; Expressions may be grouped to affect the sequence of processing. Multiplications and divisions are calculated for an expression before additions and subtractions unless parentheses are used to override the normal order. Expressions inside parentheses are processed before other calculations. In the following examples, the information in the remarks represents intermediate forms of the example calculations. Notice that, because of the order of precedence, (4 * 7) - (5 * 3); //28 - 15 = 13/ but has a different meaning from 4 * (7 - 5) * 3; //4 * 2 * 3 = 24 4 * (7 - (5 * 3)); //4 * -8 = -32 The use of parentheses is recommended whenever there may be confusion about how the expression is to be evaluated, even when parentheses are not required. ## Assignment ArithmeticEach of the operators shown in the previous section can be combined with the assignment operator, =, as a shortcut for performing operations. Such assignments use the value to the right of the assignment operator to perform an operation on the value to the left. The result of the operation is then assigned to the value on the left. The following lines are examples using assignment arithmetic: var i; ## Auto-Increment (++) and Auto-Decrement (--)To add 1 to a variable, use the auto-increment operator, ++. To subtract 1, use the auto-decrement, operator, --. These operators add or subtract 1 from the value to which they are applied. Thus, The auto-increment and auto-decrement operators can be used before their variables, as a prefix operator, or after, as a suffix operator. If they are used before a variable, the variable is altered before it is used in a statement, and if used after, the variable is altered after it is used in the statement. The following lines demonstrate prefix and postfix operations: |

Siebel eScript Language Reference |