diff --git a/docs/reference/src/components/cairo/modules/language_constructs/pages/operator_precedence.adoc b/docs/reference/src/components/cairo/modules/language_constructs/pages/operator_precedence.adoc new file mode 100644 index 00000000000..3ad4031c937 --- /dev/null +++ b/docs/reference/src/components/cairo/modules/language_constructs/pages/operator_precedence.adoc @@ -0,0 +1,26 @@ +Below is the table of operator precedence. + +The higher an operator is in the table, the earlier it is evaluated. + +[cols="1,1,1",options="header"] +|=== +| Group | Operators | Comments +| Method calls, struct member access | `.` | +| Postfix unary | `?` `[]` | +| Prefix unary | `@` `*` `!` `~` `-` | +.4+| Bitwise | `<<` `>>` | Not yet supported. + | `&` | + | `^` | + | `\|` | +.2+| Arithmetic | `*` `/` `%` .2+| * Preceded by bitwise operators starting + + from next major Cairo version (3). + + See https://github.com/starkware-libs/cairo/discussions/3552[discussion]. + | `+` `-` +| Comparison | `==` `!=` `<` `\<=` `>` `>=` | +.2+| Logical | `&&` | + | `\|\|` | +| Assignment | `=` `+=` `-=` `*=` `/=` `%=` + + `<\<=` `>>=` `&=` `^=` `\|=` | Second line not yet supported. +|===