User Guide

Table Of Contents
28 Chapter 2: Elements of CFML
CFML Basics
This chapter introduces and describes the basic elements of CFML. These elements make CFML
a powerful tool for developing interactive web applications. Because CFML is a dynamic
application development tool, it has many of the features of a programming language, including
the following:
Functions
Expressions
Variables and constants
Flow-control constructs such as if-then and loops
CFML also has a “language within a language,” CFScript, which enables you to use a syntax
similar to JavaScript for many operations.
This chapter introduces these elements and other basic CFML entities such as comments, data
types, escape characters, and reserved words.
The remainder of Part I of this manual provides more detailed information on many of the basic
CFML elements. The rest of this manual helps you use these elements effectively in your
applications.
Comments
ColdFusion comments have a similar format to HTML comments. However, they use three dash
characters instead of two; for example:
<!--- This is a ColdFusion Comment. Browsers do not receive it. --->
The ColdFusion server removes all ColdFusion comments from the page before returning it to
the web server. As a result, the page that a user browser receives does not include the comment,
and users cannot see it even if they view the page source.
You can embed CFML comments in begin tags (not just tag bodies), functions calls, and variable
text in number signs. ColdFusion ignores the text in comments such as the following:
<cfset MyVar = var1 <!--- & var2 --->>
<cfoutput>#Dateformat(now() <!---, "dddd, mmmm yyyy" --->)#</cfoutput>
This technique can be useful if you want to temporarily comment out parts of expressions or
optional attributes or arguments.
You can also nest comments, as the following example shows:
<!--- disable this code
<!--- display error message --->
<cfset errormessage1="Oops!">
<cfoutput>
#errormessage1#
</cfoutput>
--->
This is useful if you want to temporarily disable a section of code while you test your application.
You can embed comments within comments, however, you should use this technique carefully.