Liquid operators
Liquid operators are used with tags to control flow.
Last updated
Was this helpful?
Liquid operators are used with tags to control flow.
Last updated
Was this helpful?
If you've done any computer programming before, you'll be familiar with operators. In Liquid, operators let you make logical decisions and comparisons.
For example, you might need to check if a particular number is bigger than another number, or check to see if something has been filled in.
Operator
Function
==
equals
!=
does not equal
>
greater than
<
less than
>=
greater than or equal to
<=
less than or equal to
or
logical or
and
logical and
For example, here we use less than to print a statement if an opportunity charge total is less than 100.
contains
Use contains
to check for the presence of a substring in a string.
In tags with more than one and
or or
operator, operators are checked in order from right to left.
It's especially useful for multi-select , where selected list options are stored as a comma-separated string.