Operator precedence

The precedence of operators in expressions is as follows. The operators at the top of the list are evaluated before those at the bottom of the list.

  1. unary operators (operators that require a single operand)

  2. &, |, ^, ~

  3. *, /, %

  4. +, -

  5. ||

  6. not

  7. and

  8. or

When you use more than one operator in an expression, it is recommended that you make the order of operation explicit using parentheses.