When you combine several operators in a single expression, the operations are performed in the following order.
Order | Operator | Description |
---|---|---|
1 | ! | Boolean NOT |
2 | - | Negation (as in -1) |
3 | *, /, ^, and % | Multiplication, division, exponentiation, and modulus |
4 | + and - | Addition and subtraction |
5 | <, <=, >, and >= | Comparison |
6 | == and != | Equivalence |
7 | && | Boolean AND |
8 | || | Boolean OR |