Conditionals
Conditionals let you show different content to different people based on their data. Whether you want to greet VIP members differently, show content based on a user's location, or check if a field exists -- conditionals make it possible.
Basic If/Else
The simplest conditional shows one thing when a condition is true, and optionally something else when it's not:
Example: Basic if/else
Template:
Output:
Welcome, VIP member!
The structure is always:
The {else} part is optional -- you can use just {if} and {end if} if you only want to show content when the condition is true.
Else-If Chains
When you need to check multiple conditions in order, use {else if}:
Example: Else-if chain
Template:
Output:
Premium features unlocked.
The engine checks each condition from top to bottom and shows the content for the first one that matches. If none match, the {else} content is shown (if provided).
Comparison Operators
NLT supports 20 comparison operators, all written in plain English. Here they are grouped by category.
Equality
| Operator | Example |
|---|---|
is | {if the user's Status is active} |
is equal to | {if the user's Status is equal to active} |
is exactly | {if the user's Code is exactly ABC123} |
is not | {if the user's Status is not inactive} |
Example: Equality check
Template:
Output:
Account is active!
Equality checks are case-insensitive, so is active matches "Active", "ACTIVE", and "active" equally.
Numeric Comparisons
| Operator | Example |
|---|---|
is more than | {if the user's Score is more than 80} |
is greater than | {if the user's Age is greater than 18} |
is less than | {if the user's Risk is less than 5} |
is at least | {if the user's Score is at least 80} |
is at most | {if the user's Attempts is at most 3} |
is greater than or equal to | {if the user's Balance is greater than or equal to 100} |
is less than or equal to | {if the user's Risk is less than or equal to 3} |
is between X and Y | {if the user's Score is between 50 and 100} |
Example: Numeric comparison
Template:
Output:
High achiever!
Example: Between range check
Template:
Output:
In range!
Dollar signs and commas are automatically stripped in numeric comparisons. So {if the user's Total is more than $1,000} works perfectly -- no need to remove the formatting yourself.
Existence Checks
| Operator | Example |
|---|---|
is set | {if the user's Email is set} |
is not set | {if the user's Phone is not set} |
Example: Existence check
Template:
Output:
We'll send updates to your email.
Example: Missing field check
Template:
Output:
Please add your phone number.
Containment
| Operator | Example |
|---|---|
contains | {if the user's Tags contains "vip"} |
does not contain | {if the user's Tags does not contain "spam"} |
Example: Array containment
Template:
Output:
VIP member!
Example: String containment
Template:
Output:
Internal user
contains works on both arrays (checks if the item is in the list) and strings (checks for a substring). It's case-insensitive in both cases.
Date Comparisons
| Operator | Example |
|---|---|
is today | {if the user's Birthday is today} |
is this week | {if the user's Appointment is this week} |
is this month | {if the user's Trial End is this month} |
is within the last N days | {if the user's Last Purchase is within the last 30 days} |
is within the last N weeks | {if the user's Signup is within the last 2 weeks} |
is within the last N months | {if the user's Activity is within the last 3 months} |
is before | {if the user's Expiry is before 2026-12-31} |
is after | {if the user's Start Date is after 2026-01-01} |
Example: Date: is today
Template:
Output:
Happy Birthday!
Example: Date: within the last N days
Template:
Output:
Recent customer
Example: Date: before a specific date
Template:
Output:
Expiring soon
Both singular and plural time units work: within the last 1 day and within the last 30 days are both valid.
Combining Conditions
AND (all must be true)
Use and to require multiple conditions:
Example: AND: both conditions must be true
Template:
Output:
Elite VIP status!
OR (at least one must be true)
Use or to match any of several conditions:
Example: OR: either condition can be true
Template:
Output:
English content
NOT (negate a condition)
Use not to flip a condition:
Example: NOT: negate a condition
Template:
Output:
Please add your email address.
Combining AND and OR
You can mix and and or in a single condition. AND has higher priority than OR (just like in math, where multiplication happens before addition):
This evaluates as: Plan is premium OR (Score > 90 AND VIP is yes).
Since AND binds more tightly than OR, be careful with complex conditions. If you need a different grouping, consider breaking it into nested {if} blocks instead.