Comparison Operators

Comparison operators are used to compare two values, or operands. The result of the evaluation will return a Boolean result. There are six comparison operators available in AMPscript.

The operands need to be the same type; for example, string, date, number or Boolean:

Operator Description
== is equal to
!= is not equal to
> is greater than
< is less than
>= is greater than or equal to
<= is less than or equal to

String operands can only use == or != operators for comparison. String comparisons are evaluated as case-insensitive, so "GOLD" == "gold" will evaluate to true.

Example 1

The example below indicates a string comparison (in the AMPscript block) and a Boolean comparison (in inline AMPscript):


Not a subscriber? Subscribe now.

Example 2


Not a subscriber? Subscribe now.