## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Expressions

Expressions are the building blocks of the CFML language. In its most basic form, an expression is nothing more than a single element such as `1`, `test`, `MyVar`, or `CHR(54)`. Compound expressions let you to evaluate data that is acted upon by operators. For example, `1*10` is a mathematical expression that evaluates to `10`. The values `1` and `10` are both data, while the asterisk (`*`) is considered an operator. On the other end of the spectrum, expressions can be complex, consisting of one or more subexpressions:

`<CFSET x = 1+(10 MOD (3 * (11 - ACOS(-1))))>`

## Operators

Operators allow you to perform calculations and make comparisons between expressions. In other words, they allow you to combine simple expressions to form ones that are more complex. For example, `<CFSET x = 10*(3+2)>` uses the asterisk (`*`) as an operator to multiply 10 by the sum of another expression that uses the plus (`+`) operator to add 3 and 2. There are four types of operators available in ColdFusion:

Arithmetic

Performs arithmetic operations such as sign changes, addition, subtraction, etc., on numeric values.

Comparison

Compares two values and return a Boolean `True`/`False`.

String

There is only one string operator in the CFML language. The ampersand (`&`) concatenates strings.

Boolean

Also known as logical operators, Boolean operators perform connective and negation operations and return Boolean `True`/`False` values.

Table 2-2 lists the operators available in ColdFusion by order of precedence (P).

Table 2-2. ColdFusion ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required