Operators
Operators are used within delimiters in expressions
like IF and FOR.
Logical operators
You can use any of the logical operators listed below.
== | Equal |
!= | Not equal |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
or | A or B |
and | A and B |
Containment operator
The in operator performs a containment test.
It returns true if the left operand is contained in the right, e.g.
{{ 1 in [1, 2, 3] }} {{ 'cde' in 'abcde' }}
You can also use the not in operator to perform a negative test
{% if 1 not in [1, 2, 3] %} {% if 'cd' not in 'abcde' %}
Test operator
The is operator can be used to perform tests to test a variable against a common expression.
{% if product.title is 'trainers' %}