Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
%%[ /* IIF() */
var @firstName, @intro
set @firstName = AttributeValue("firstName") /* returns blank if null */
set @intro = "Hello"
if not empty(@firstName) then
set @intro = concat(@intro, ", ", @firstName)
endif
set @intro = concat(@intro,"! Check out these deals")
]%%
inline: %%=concat("Hello",iif(empty(@firstName), "",concat(", ", @firstName)),"! Check out these deals")=%%
<br>single variable: %%=v(@intro)=%%
#OUTPUT
inline: Hello! Check out these deals
single variable: Hello! Check out these deals
or
inline: Hello, Adam! Check out these deals
single variable: Hello, Adam! Check out these deals
@nburggraf
Copy link

You should maybe use a ProperCase function for the @firstname variable...Unless your user input is auto-corrected at point of entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment