Complete operator table
See the precedence table for grouping. = and the five compound forms are statement syntax. ... has context-specific syntax rather than an expression precedence.
| Operator | Operation |
|---|---|
= |
Assignment, constant/default initialization or keyed literal entry, by context. |
+= -= *= /= %= |
Read an assignable target, apply the corresponding binary operation and write the result. |
?? |
Null-only fallback. |
or and |
Select operands based on truthiness and short-circuit. |
not |
Boolean negation of truthiness. |
== != |
Equality and inequality. |
< <= > >= |
Numeric or text ordering. |
| ^ & |
Integer bitwise OR, XOR and AND. |
<< >> |
Integer left and right shift. |
.. |
Constructs a half-open range. |
+ |
Numeric addition, text concatenation or prefix numeric identity. |
- |
Numeric subtraction or prefix numeric negation. |
* / % |
Multiplication, division, remainder. |
~ |
Prefix 64-bit integer complement. |
** |
Exponentiation. |
() |
Postfix function call, or parenthesized expression in prefix position. |
[] |
Postfix indexed access/slice, array literal in prefix position, or computed literal key with following =. |
. |
Named member access. |
?. |
Optional named member access on a null receiver. |
... |
Spread elements, declare a final variadic parameter, or collect destructuring rest. |
Delimiters include colon for suites, commas for items or bindings, braces for dictionaries and hybrids, and single quotes for text. Line breaks and indentation delimit statements and suites.