Skip to main content
Skip table of contents

Operators

ZML includes many logical and comparison operators.

Operator

Description

==

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,

{% if color_preference == "red" %}

You prefer red things!

{% endif %}

Multiple operators are permitted as well:

{% if color_preference == "red" or color_preference == "blue" %}

You prefer red or blue things!

{% endif %}

Contains

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

{% if recipient_email contains "@gmail.com" %}

You use gmail!

{% endif %}

contains can also check for the presence of a string in an array of strings. Assuming we have an array called subscription_preferences:

{% if subscription_preferences contains "newsletter" %}

You are subscribed to newsletters.

{% endif %}

contains can only search strings. You cannot use it to check for an object in an array of objects.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.