O'Reilly logo

Programming ColdFusion by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

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

Start Free Trial

No credit card required

Datatypes

ColdFusion supports a number of datatypes for use in building expressions. These datatypes can be broken into two categories, simple and complex. The simple datatypes are made up of Booleans, strings, numbers (both integer and floating point), and date/time objects:

Boolean

ColdFusion uses the Boolean datatype to store the value generated by a logical operation. Boolean values are stored as either TRUE or FALSE. In numeric operations, Boolean values evaluate to 1 for TRUE and 0 for FALSE. When dealing with strings, Boolean values are set to Yes for TRUE and No for FALSE. Note that no quotes are necessary to delimit Boolean values.

Strings

ColdFusion stores text values in strings delimited by a set of single or double quotes. For example, "This is a string." and 'So is this!' are both strings. "1000" and '1000' are also strings so long as the numbers are delimited by a set of quotes. The empty string can be written as either '' or "". There are certain special characters that must be escaped within strings. These special characters are the single quote ('), double quote ("), and pound sign (#). These characters may be escaped by doubling up on them as in the following examples:

<CFSET String1 = "This is a ""good"" use of escaped double quotes">
<CFSET String2 = "This is a ''good'' use of escaped single quotes">
<CFSET String3 = "What is the ##1 team in the league?">

As we’ll discuss in the next section, <CFSET> is a CFML tag you use to set a variable to a particular ...

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

Start Free Trial

No credit card required