If you did not include the pound signs around the
ColdFusion would not evaluate the function and the previous example would display your source
code, as follows:
For more information about how to use pound signs with functions, see Developing ColdFusion
MX Applications.
Variables
Variables let you store data in memory on the server. Variables always have a name and a value.
You can assign a value to a variable, or you can instruct ColdFusion to assign variable values based
on data that it retrieves from a data source, such as a database table.
Naming variables
You must use the following rules for naming ColdFusion variables:
•
Names are case insensitive (uppercase, lowercase, or mixed case).
•
Names can contain only letters, numbers, and underscore characters.
•
Each name must begin with a letter.
•
Special characters (such as double quotation marks ("), reserved names (such as functions and
tags), and spaces are not allowed.
Ways to use variables
You can use a variable for the following purposes:
•
Store data collected from a form.
•
Store results of a calculation (such as the number of database records returned).
•
Use as input to a function.
Creating variables with the cfset tag
ColdFusion lets you create variables as you need them. You create the variable (name and value)
using the
cfset
<cfset variable_name = value>
tag. The syntax for this tag is:
DateFormat(Now(), "mm/ddyyy")
Understanding CFML elements
function,
21
Need help?
Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?