CFML Data Operators

You can make use of all the following operators in your OpenBD apps.

  • Assignment
    • =
    • +=
    • -=
    • %=
    • /=
    • *=
    • &=
  • Unary Arithmetic
    • ++
    • --
    • +
    • -
    • /
    • *
  • Binary Arithmetic:
    • % or MOD
  • Comparators
    • == or EQ
    • != or NEQ or NOT EQUAL
    • < or LT or LESS THAN
    • > or GT or GREATER THAN
    • <= or LTE or LESS THAN OR EQUAL TO
    • >= or GTE or GREATER THAN OR EQUAL TO
    • IMP
    • EQV
    • IS
    • IS NOT
    • CONTAINS
  • Logical
    • ! or NOT
    • || or OR
    • && or AND
    • XOR

Some examples of this in usage

<cfset a = 1>
<cfset a++>

<if ( a < 2 )>
  <cfset a-->
</if>

<if a LTE 2>
  <cfset a-->
</if>

<cfscript>
if ( a == "b" && c != "d" ){
  d &= "append";
}
</cfscript>

Note if you use the comparators inside of a CFIF tag, then please be use to wrap it in (), otherwise you will throw a parsing error.