Logical operators can be used to create more complex conditions in our templates.

Currently supported logical operators:

and: Returns true if both the left and right operands are true.

Example of use:

{# Both are true #}
{% if true and true %}
  {# Returns true #}
{% endif %}

or: Returns true if at least one of the operands, either left or right, is true.

Example of use:

{# At least one is true #}
{% if true or false %}
  {# Returns true #}
{% endif %}

not: Negates an expression, inverting its logical value.

Example of use:

{# Negates the logical value #}
{% if not false %}
  {# Returns true #}
{% endif %}

(expr): Groups an expression to define operator precedence.

Example of use:

{# Grouping expressions #}
{% if (true or false) and true %}
{# Returns true #}
{% endif %}