Progress
Results User’s Guide
for UNIX
Evaluating Expressions
When evaluating expressions, Results uses precedence in determining the result. Consider the following expression:
3 * 5 + 2
The result of this expression is different depending on the order that you process the multiplication and addition operators. For example, 3 * (5 + 2) is 21 but (3 * 5) + 2 is 17.
If an expression contains two operators of equal precedence, Results evaluates the expression from left to right. If the operators are not of equal precedence, Results evaluates the operator of higher precedence first. For example, Results evaluates AND before it evaluates OR. Also, you can use parentheses to change the default order used to evaluate an expression.
Table F–1 shows the precedence, or order of processing, of functions and operators.
Rules
When using an operator, you must leave a space to the left and to the right of that operator. For example, here is a valid use of an operator:
x + y
Whereas, this is an invalid use of an operator:
x+y
Examples
Table F–2 provides examples to help illustrate how Results evaluates expressions.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |