User Guide

Table Of Contents
76 Chapter 4: Using Expressions and Number Signs
Note that the operator is surrounded by expressions. Each expression can be a simple operand
(variable or constant) or a subexpression consisting of more operators and expressions. Complex
expressions are built up using subexpressions. For example, in the expression (1 + 1)/2, 1 + 1 is a
subexpression consisting of an operator and two operands.
Operator types
ColdFusion has four types of operators:
Arithmetic
Boolean
Decision (or comparison)
String
Functions also can be viewed as operators because they act on operands.
Arithmetic operators
The following table describes the arithmetic operators:
Boolean operators
Boolean, or logical, operators perform logical connective and negation operations. The operands
of Boolean operators are Boolean (True/False) values. The following table describes the Boolean
operators:
Operator Description
+ - * / Basic arithmetic: Addition, subtraction, multiplication, and division. In division, the right
operand cannot be zero.
+ - Unary arithmetic: Set the sign of a number.
MOD Modulus: Return the remainder after a number is divided by a divisor. The result has the
same sign as the divisor. The right should be an integer; using a non-numeric value
causes an error, and if you specify a real number, ColdFusion ignores the fractional part
(for example, 11 MOD 4 is 3).
\ Integer division: Divide an integer by another integer. Use the backslash character (\) to
separate the integers. The right operand cannot be zero. For example, 9\4 is 2.
^ Exponentiation: Return the result of a number raised to a power (exponent). Use the
caret character (^) to separate the number from the power; for example, 2^3 is 8. Real
and negative numbers are allowed for both the base and the exponent. However, any
expression that equates to an imaginary number, such -1^.5 results in the string "-1.#IND.
ColdFusion does not support imaginary or complex numbers.
Operator Description
NOT Reverse the value of an argument. For example, NOT True is False and vice versa.
AND Return True if both arguments are True; return False otherwise. For example, True AND
True is True, but True AND False is False.