Created
December 11, 2015 17:51
-
-
Save wvpv/ff17dc9cf0b44296ef26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ /* 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should maybe use a ProperCase function for the @firstname variable...Unless your user input is auto-corrected at point of entry.