Order of Precedence

When an expression is evaluated, an order of precedence for each operator is applied. The order of precedence determines which operators (and the values on each side of the operator) are evaluated first. The following table lists each operator from highest to lowest precedence.

Operator

Precedence

any function, or parentheses

1

<, <=, >, >=, <>, =

2

*, /

3

+, - (subtraction)

4

   

You can change the order of precedence by enclosing an expression in parentheses. Parentheses are regarded with the highest priority; therefore, all expressions within the parentheses are evaluated first. Operators with the same precedence are evaluated in the order they appear from left to right.

Example: Changing the Order of Precedence

For example, consider the following expressions:

Expression

Value

6+4/2

8

(6+4)/2

5

Under normal circumstances, the Expression Builder will evaluate multiplication and division operations before addition and subtraction. If you want two values to be added or subtracted before a division or multiplication operation is performed, you must enclose them in parentheses.