5
Operators
harttle edited this page 2019-10-20 23:22:03 +08:00

Operators

Liquid operators are very simple and different. According to the operators document from Shopify, there're 2 types of operators supported:

  • Comparison operators: ==, !=, >, <, >=, <=
  • Logic operators: or, and, contains

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

Precedence

The comparison operators have higher precedence than logic operators.

Associativity

Logic operators are evaluated from right to left, see shopify docs.