Operators are special characters or words that perform operations for you - a comparison, for example.
The following operators are available for Twig and are supported in any expression in the Emarsys Scripting Language:
-
Comparison operators: Compare values and return true or false state. The operators include:
==
,!=
,<
,>
,>=
,<=
-
Logical operators: Combine multiple boolean expressions or values and provide a single boolean output. The operators include:
and
,or
Note: Operators in our system are case sensitive and must be used in lowercase. For 'if' statements, operators should be written in lowercase only.
Operator | Use |
or | Use in an "if" statement to check if either condition 1 or 2 is true |
in | use in an "if" statement to check if value is in a string or array |
and | use in an "if" statement to check if both conditions are true |
>= | greater than or equal to |
> | greater than |
== | use to check whether two strings are equal |
= | use to set variables |
<= | less than or equal to |
< | less than |
/ | division |
- | subtraction |
+ | addition |
* | multiplication |
() | used for grouping expressions |
% | divisible |
!= | use to check whether two strings are not equal |
These are the same as operators in Twig.