1. Home
  2. Docs
  3. Personalization
  4. Reference
  5. <$eval$> Syntax Recap

<$eval$> Syntax Recap

The eval statement takes templating tags, template functions, custom fields, conditional logic, and inserts the results into your message, instead of deciding whether to insert the content (that’s the <$if$> … <$endif$> tag).

It may contain conditional logic (via the <$if$> tag), and multiple statements when the semicolon statement separator is used.

For example, this is valid:

<$eval sport:="soccer"; alias:="football"; <$if sport==alias>These are the same!<$else$> No, they’re not!<$endif$> $>

which will always result in “No, they’re not!” being added to the email.

Alternate <$eval$> syntax

You can use <$% expression $> instead of <$eval expression $>

Flexible Syntax

Template functions can be used in a functional programming style, or a pipe-like stream style. These are equivalent and both valid template personalization syntax, as in the following example for inserting an MD5 hash:

  • <$eval MD5(email) $>
  • <$eval email MD5 $>

You can mix and match these approaches to build templating code that you find the most readable and maintainable, as in the following examples which all provide an upper case MD5 hash of a lowercase email address:

  • <$eval uppercase(lowercase(email) MD5) $>
  • <$eval uppercase(MD5(lowercase(email))) $>
  • <$eval MD5(email lowercase) uppercase $>
  • <$eval email lowercase MD5 uppercase$>