The ColdFusion decision, or comparison, operators produce a Boolean True/False result. The following table describes the decision operators:
Operator | Description |
---|---|
IS |
Perform a case-insensitive comparison of two values. Return True if the values are identical. |
IS NOT |
Opposite of IS. Perform a case-insensitive comparison of two values. Return True if the values are not identical. |
CONTAINS |
Return True if the value on the left contains the value on the right. |
DOES NOT CONTAIN |
Opposite of CONTAINS. Return True if the value on the left does not contain the value on the right. |
GREATER THAN |
Return True if the value on the left is greater than the value on the right. |
LESS THAN |
Opposite of GREATER THAN. Return True if the value on the left is smaller than the value on the right. |
GREATER THAN OR EQUAL TO |
Return True if the value on the left is greater than or equal to the value on the right. |
LESS THAN OR EQUAL TO |
Return True if the value on the left is less than or equal to the value on the right. |
You can replace some decision operators with alternative notations to make your CFML more compact, as shown in the following table:
Operator | Alternative name(s) |
---|---|
IS |
EQUAL, EQ |
IS NOT |
NOT EQUAL, NEQ |
GREATER THAN |
GT |
LESS THAN |
LT |
GREATER THAN OR EQUAL TO |
GTE, GE |
LESS THAN OR EQUAL TO |
LTE, LE |
The following rules apply to decision operators:
123.45 CONTAINS 3.4
"a" IS "A"
"ab" LT "aba" "abde" LT "ac"