Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/elixir/pages/references/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Operator | Associativity
`*` `/` | Left
`+` `-` | Left
`++` `--` `+++` `---` `..` `<>` | Right
`//` (valid only inside `..//`) | Right
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it here if it is only valid as part of ternary operator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because precedence still applies with operators outside of the ternary.

`in` `not in` | Left
`\|>` `<<<` `>>>` `<<~` `~>>` `<~` `~>` `<~>` | Left
`<` `>` `<=` `>=` | Left
Expand All @@ -29,11 +30,18 @@ Operator | Associativity
`\|\|` `\|\|\|` `or` | Left
`=` | Right
`&`, `...` | Unary
`=>` (valid only inside `%{}`) | Right
`\|` | Right
`::` | Right
`when` | Right
`<-` `\\` | Left
`=>` (valid only inside `%{}`) | None

Elixir also has two ternary operators:

Operator | Associativity
---------------------------------------------- | -------------
`first..last//step` | Right
`%{map \| key => value, ...}` | None

## General operators

Expand Down