Operators in CFML

This is an incomplete / work in progress guide to operators in CFML.

Equality

EQ ScriptTags

IS ScriptTags

== ScriptTagsCF 8+

if (animal == "cow") {
    return "mooo!";
}

The EQ IS and == operators are case insensitive, so "PETE" IS "pete" evaluates true

Inequality

NEQ ScriptTags

IS NOT ScriptTags

!= ScriptTagsCF 8+

if (true != false) {
    return "sanity";
}

Negation

NOT ScriptTags

! ScriptTagsCF 8+

if ( !isLocalHost(cgi.remote_addr) ) {
    throw("sorry localhost only");
}

Comparison

GREATER THAN ScriptTagsGT ScriptTags

GREATER THAN OR EQUAL TO ScriptTagsGTE ScriptTags

LESS THAN ScriptTagsLT ScriptTags

LESS THAN OR EQUAL TO ScriptTagsLTE ScriptTags

Concatination

& ScriptTags

name = name & " Jr.";

&= ScriptTagsCF 8+

name &= " Jr."; 

Both code examples are equivilent.

Compatibility Notes

The operators == != < <= > >= do not work in tags such as cfif or cfset in Adobe ColdFusion (as of Version 2016). However the == != < <= operators work from tags on Lucee, but > >= do not.


Fork me on GitHub