Operator expressions
The following sections describe the operators that you can use in expressions.
When using several operators in the same expression, you can use parentheses to define the
order of the operations. For example, in 3 * (1 + 2), the 1
+ 2 addition is performed first. If you do not use parentheses, the
following order is used:
- *, / and %
- + and -
- =, ==, !=, <, <=, > and >=
- && and ||
For example:
- 3 * 1 + 2 is equivalent to (3 * 1) + 2
- 3 * 1 + 2 / 2 is equivalent to (3 * 1) + ( 2 / 2 )
- 3 + 1 == 8 / 2 || 1 + 3 * 2 >= 9 - 5 is equivalent to ((3 + 1) == (8 / 2)) || (( 1 + (3 * 2)) >= (9 - 5))