Skip to content

Expressions

Precedence

The operator precedence and expression ordering is as follows, going from strong to weak. Binary operators at the same precedence level are grouped in the order given by their associativity.

Expression type Associativity
Name
Unary +, -, &, *
as
*, /, % Left
+, - Left
>>, >>>, << Left
& Left
^ Left
| Left
==, !=, >, <, >=, <= Left
&& Left
|| Left
.. Not allowed together1
..= Not allowed together1
=, +=, -=,
*=, /=, %=,
>>=, >>>=, <<=,
&=, ^=, |=
Right

  1. Syntax x..y..z will cause an error, you need to put parentheses to explicitly define associativity.