LIQUID FOR TECHNICAL MARKETERS: Comparison Operators
🗣️ WATCH FULL YOUTUBE VIDEO HERE 🗣
What’s up everyone, my name is Allan, Founder and Consultant at For Now Marketing, and welcome to LIQUID FOR TECHNICAL MARKETERS!
If your goal is to improve your Liquid coding skills, then please
- like this video
- subscribe to our channel
- watch this video all the way to the end
- and keep an eye out for more videos in the future.
Today, we’re going to talk about Comparison Operators in Liquid. They’re pretty simple and very consistent with most other coding languages. There’s only 6 Comparison Operators to cover; let’s get started!

Liquid Conditionals Sneak Peek
Before we jump into our first Comparison Operator, I want to give us a heads up that we’re going to see some Liquid Conditionals in today’s video, like if-statements, which we haven’t covered quite yet.
We’ll certainly discuss if statements and other Liquid Conditionals in detail in a future video. The reason we’re seeing some Liquid Conditional sneak peeks now is that Comparison Operators are only relevant inside Liquid Conditionals, and Liquid Conditionals rely on Comparison Operators.
So by going over the Comparison Operators, that gets us ready to tackle Liquid Conditionals, which we know is an exciting topic for many Liquid users.
For all examples today, if the Liquid Conditional statement is logically true, then the message between the “if tag” and “endif tag” will render.
Equals ==
That being said, let’s get started with our first one, the double equal sign. In most coding languages, if not all, whenever you see double equal sign, it’s in the context of comparison operators. The double equal sign simply checks if two values are equal to each other.
So this code is saying “if city equals Los Angeles”, then the Liquid code renders “Welcome to Sunny Los Angeles!”
Notice that when we assign values to variables using the assign tag, we use one equal sign. So assign tag uses one equal sign, and Comparison Operators use two equal signs.
Does Not Equal !=
The next one is exclamation equal sign, which means does not equal. Once again, in most coding languages, if not all, the exclamation sign actually means “not”. So by writing “!=”, this means does not equal.
Here’s another example. “if name does not equal Allan”, then the Liquid code renders, “Sorry, we’re looking for Allan! Have you seen him?”
We can use both the “equals” and the “does not equals” operators to compare any 2 variables of the same datatype. We’re simply comparing if the 2 values are equal or not equal.
Greater Than >, Less Than <
The next two operators are more relevant for Numbers, and those are “greater than” and “less than”. Yup, it’s the exact same ones from our elementary school math classes. We’re comparing two values, most likely two numbers, to see if one is greater than or less than the other.
So in this example, we check to see if attempts is greater than 5, and if so, the Liquid renders, “More than 5 attempts. Your account is locked.” We hate when that happens!
And the “less than” operator works exactly the same way.
By the way, if the variable attempts was exactly 5, this comparison would not be true. This comparison is only true if attempts is greater than 5, so 6 and above, but not equal to 5.
Well, if we’re being super technical, anything greater than 5 works, so 5.00000001 is technically greater than 5. But in our example, it doesn’t make a lot of sense to have 5.00000001 attempts.
Greater Than Or Equal To >=, Less Than Or Equal To <=
We won’t spend too much time for these two operators which are “greater than or equal to” and “less than or equal to”. It’s exactly as they sound. Now, with “greater than or equal to”, even if attempts equaled 5, this comparison would still be true, and we’d probably have to change our message.
By the way, it can be confusing to remember the order of the symbols. Does the equal sign come before or after?
The symbols always come in the order of their name. So “greater than or equal to” will start with the “greater than” sign followed by the equal sign. “Less than or equal to” will start with the “less than” sign followed by the equal sign.
Now, if you can’t remember which direction is “greater than” and which direction is “less than”, I always think of the L method. The “less than” sign looks like an L, so therefore, it’s the “less than” symbol. Good thing I used to be a high school math teacher.

Thank You!
That’s it for today! The Comparison Operators are pretty straight forward, but it was still important to go over them before we introduce our next big topic: Liquid Conditionals. Stay tuned for the next video as we’ll dive more into the if-statements that we saw in our examples.
Thank you for watching, and see you next time!
allan@fornowmarketing.com
fornowmarketing.com