Operator Precedence

Let’s study the operators that hold precedence over others.

We'll cover the following

Overview

Operator precedence determines the order with which different parts of the code/expression should be evaluated. For instance, 1 + 1 * 5 would give us 6 rather than 10 as * has higher precedence than +. If we wanted 10 we could write the expression as (1 + 1) * 5 as () has higher precedence than *.

Precedence table

Below, you’ll find the precedence, with operator precedence being highest at the top and getting lower as you come down. Each operator has a higher precedence than the operators in the rows that follow it.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy