# Order of Precedence

In mathematics, there is a predefined order in which operators are performed.

- parentheses
- transpose and exponentiation
- unary plus and minus, logical not
- multiply and divide
- add and subtract
- colon
- relational (inequality)
- &
- |
- &&
- ||
- assignment

1+2*3 gives an answer of 7 because * has a higher priority than + .

(1+2)*3 gives an answer of 9 because ()’s have a higher priority than *