Build Your Course The Easy Way
Get Started Free

Operators

Liquid has access to all of the logical and comparison operators. These can be used in tags such as if and unless.

In this article:


Basic Operators

== equals
!= does not equal
> greater than
< less than
>= greater than or equal to
<= less than or equal to
or condition A or condition B
and condition A and condition B

contains

contains checks for the presence of a substring inside a string.

{% if product.title contains 'Academy' %} <h1>Welcome to the Academy!</h1> {% endif %} contains can also check for the presence of a string in an array of strings.

{% if blog_post.tags contains 'podcast' %} <p>Thanks for tuning in!</p> {% endif %} However, you cannot check for the presence of an object in an array of objects using contains.

Contact support or access our 24/7 Live Chat:

Contact Support Live Chat

Need Help? Live Chat with Us.