...

/

Operator Precedence

Operator Precedence

In the following lesson, you will be introduced to which operators in Scala hold precedence over others.

Introduction

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 *.

By now we have concluded that operators in Scala aren’t really operators, they are simply methods in ...