Handlebars iif
Handlebars iif: picks one of two values, depending on whether an expression is true or false.
Next
Runtime verified
Test scripts included
Picks one of two values, depending on whether an expression is true or false.
Syntax
{{iif expression leftResult rightResult}}
Returns any.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
expression |
any | Yes | Condition to test. |
leftResult |
any | Yes | Value returned when the expression is true. |
rightResult |
any | Yes | Value returned when the expression is false. |
Example
Tested in a Marketing Cloud Next email on 2026-11-22:
{{iif true "y" "n"}}rendersy, as documented.{{iif 0 "y" "n"}}rendersn, as documented.
Show Next test script
Marketing Cloud Next
Works as documented
Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.
See also
- AMPscript
IIf— the AMPscript equivalent - Official reference