Runtime verified Differs from official docs Test scripts included

Compares two values for equality, optionally by a comparison type.

Syntax

{{equals value1 value2 [compareAs]}}

Returns boolean.

Parameters

Name Type Required Description
value1 any Yes First value to compare.
value2 any Yes Second value to compare.
compareAs string No Comparison type: date, datetime, number, or string. Defaults to string.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{equals "a" "a"}} renders true, as documented.
  • {{equals "5.0" 5 "number"}} renders false. The documented result is true.
Show Next test script
<!-- Marketing Cloud Next test script for the equals helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[true] got=[{{equals "a" "a"}}]</p>
<p>c2 expect=[false] got=[{{equals "5.0" 5 "number"}}]</p>

Differs from official docs

  • The reference says the optional third argument picks the comparison type, and number compares the two values as numbers. In Marketing Cloud Next (tested 2026-11-22): {{equals "5.0" 5 "number"}} rendered false, although both values are the number 5. A plain string comparison, {{equals "a" "a"}}, rendered true. Details

Marketing Cloud Next

See also