Skip to content

Commit 3a02eb1

Browse files
authored
docs: update tutorial on operators and precedence (#830)
1 parent 9067078 commit 3a02eb1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/source/tutorials/operators.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ title: Operators
55
LiquidJS operators are very simple and different. There're 2 types of operators supported:
66

77
* Comparison operators: `==`, `!=`, `>`, `<`, `>=`, `<=`
8-
* Logic operators: `or`, `and`, `contains`
8+
* Logic operators: `not`, `or`, `and`, `contains`
99

1010
Thus numerical operators are not supported and you cannot even plus two numbers like this `{% raw %}{{a + b}}{% endraw %}`, instead we need a filter `{% raw %}{{ a | plus: b}}{% endraw %}`. Actually `+` is a valid variable name in LiquidJS.
1111

1212
## Precedence
1313

14-
1. Comparison operators. All comparison operations have the same precedence and higher than logic operators.
15-
2. Logic operators. All logic operators have the same precedence.
14+
1. Comparison operators, and `contains`. All comparison operators alongside `contains` have the same (highest) precedence.
15+
2. `not` operator. It has slightly more precedence than `or` and `and`.
16+
3. `or` and `and` operators. These logic operators have the same (lowest) precedence.
1617

1718
## Associativity
1819

1920
Logic operators are evaluated from right to left, see [shopify docs][operator-order].
2021

21-
[operator-order]: https://help.shopify.com/en/themes/liquid/basics/operators#order-of-operations
22+
[operator-order]: https://shopify.dev/docs/api/liquid/basics#order-of-operations

0 commit comments

Comments
 (0)