The operators in an expression are processed in a certain order. This order of precedence can be influenced by the use of parentheses. Operators of equal precedence are applied from left to right.
The following table lists all operators and parentheses in the order of their precedence:
Operator |
Function |
Example |
( ) |
Parentheses override precedence rules. Operations inside parentheses are applied first. |
(x+y) * (x-y) |
+ - |
Monadic plus/monadic minus |
-1 |
* / |
Multiply, divide (diadic) |
y/2 |
+ - |
Add, subtract (diadic) |
y-2 |