Operators
The SovLabs Template Engine allows for logical and comparison operators
Basic Operators
== |
equals |
!= |
does not equal |
> |
greater than |
< |
less than |
>= |
greater than or equal to |
<= |
less than or equal to |
or |
logical or |
and |
logical and |
Multiple operators can be used in a tag
Input
-
user.name = 'John Doe'
{% if user.name == 'John Smith' or user.name == 'Jane Smith' %} Hello Smith {% else %} Hello stranger {% endif %}
Output
-
Hello stranger
contains
contains
checks for the presence of a substring inside a string or in an array of strings
Input
-
user.name = 'John Doe'
{% if user.name contains 'John' %} Username contains John {% endif %}
Output
-
Username contains John
contains
can only search strings and cannot check for an object in an array of objects