Skip to content

Commit

Permalink
Added operator precedence to docs (#5656)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvalsw committed May 28, 2024
1 parent da3abfc commit c6d6029
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.
|===

0 comments on commit c6d6029

Please sign in to comment.