Operator Precedence

An expression can be built from several smaller expressions combined using multiple operators. In these complex expressions, the operators are evaluated in order of their Precedence. Operators with higher precedence are performed before operators with lower precedence. For example, when evaluating arithmetic expressions, multiplication occurs before addition.

In other words, the expression 1 + 2 * 3 evaluates to 7 rather than 9, because the 2 and 3 are multiplied before the 1 is added, regardless of whether the addition is written first.

Each of the different operator types will be covered in more detail in later lessons in this course.

 

<< Previous: Operators | Next: Literals >>