wvpv
12/11/2015 - 5:51 PM

sfmc-ampscript-dynamic-subject-line-options.amp

%%[ /* 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