Programming instructions
22 Chapter 2 CFML Basics
As mentioned, it is important that elements are identified properly in your expression so
ColdFusion processes them as expected, and you can avoid unnecessary errors. When
writing expressions, consider the following coding practices:
• Character case consistency
• When to use the pound (#) sign
• When quotation marks are needed
Specifying a consistent character case
Because the ColdFusion server is case-insensitive, you can write expressions using all
uppercase, all lowercase, or mixed case. However, for code readability and consistency,
you should use the same character case in all your programs. If you write your programs
using the same case rules, you might prevent errors from occurring when you combine
CFML on a page with case-sensitive languages, such as JavaScript.
Specifying pound signs to denote functions or variables
In ColdFusion, you specify pounds signs to denote functions and variables within a
string of text. You use pounds signs to show the results of the function or variable on the
page. Pounds signs instruct the ColdFusion server to evaluate the function (or variable)
between the pound signs and display the value. The value of the function (or variable)
appears in the browser as a result.
The following list identifies some common ways to use pound signs:
• In the following example, you include the pound signs to return the value to a page:
<cfoutput> Hello #variables.my_first_name# </cfoutput>
If you omit the pound signs, the text, not the value, appears on the page.
• In the following example, you do not include the pound signs because you are using
cfset to assign one variable’s value to another value:
<cfset my_full_name = variables.my_first_name & " " & variables.my_last_name>
• To display a pound sign on a page, you must designate the pound sign as a literal
character. You do this by using two pound signs (##); for example:
<cfoutput>
##1: Your name.
</cfoutput>
The result is the following output:
#1. Your name.
For more information and examples on using pound signs in expressions, see Developing
ColdFusion MX Applications with CFML.