Changing Evaluation Order of Operators

From InterBase
Jump to: navigation, search

Go Up to Determining Precedence of Operators


To change the evaluation order of operations in an expression, use parentheses to group operations that should be evaluated as a unit, or that should derive a single value for use in other operations. For example, without parenthetical grouping, 3 + 2 * 6 evaluates to 15. To cause the addition to be performed before the multiplication, use parentheses:

(3 + 2) * 6 = 30
Tip: Always use parentheses to group operations in complex expressions, even when default order of evaluation is desired. Explicitly grouped expressions are easier to understand and debug.