IIf

This in-line IF function returns the value of the second argument if the value for the first argument evaluates as true.

Arguments

IIf(1,2,3)

Ordinal Type Required Description
1 String True Conditional expression that returns a true or false
2 String True Value to return of the conditional expression returns true
3 String True Value to return of the conditional expression returns false

Example

%%[

var @greeting
var @firstName
set @firstName = AttributeValue("firstName")
set @greeting = Iif(not Empty(@firstName), @firstName, "Member")

]%%
Dear %%=v(@greeting)=%%,

Output

Dear Member,