MACROMEDIA COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX Getting Started page 25

Building coldfusion mx applications
Table of Contents

Advertisement

Specifying quotation marks around values
When assigning literal values to variables, you must surround the literal value with double
quotation marks or single quotation marks. ColdFusion interprets the content between the
quotation marks as a literal value and assigns that value to the variable; for example:
<cfset my_first_name = "Kaleigh">
<cfset my_last_name = "Smith">
<cfset my_age = 5>
ColdFusion instantiates the variable
is assigned to the variable
When referencing a variable by its name, you do not surround the name with quotation marks;
for example:
<cfset the_string = "My name is " & variables.my_first_name &
" and my age is " & variables.my_age>
is literal text and, you therefore, surround it with quotation marks. The variable
My name is
references
variables.my_first_name
quotation marks. ColdFusion uses the values of the referenced variables (
respectively) when assigning the value to the variable
To display quotation marks on a page as literal characters, you must double the quotation marks;
for example:
<cfset mystring = "We all shouted ""Happy Birthday"" when he entered the
room.">
<cfoutput>
#mystring#
</cfoutput>
The result is the following output:
We all shouted "Happy Birthday" when he entered the room.
Specifying operators in expressions
In ColdFusion, you use operators to test conditions; for example, you use the
for equality. When using operators in expressions, you must only use supported logical operators
that ColdFusion can interpret properly. For example, if you use the greater than operator (>)or
the less than operator (<), ColdFusion interprets these operators as the start or end of a tag.
The following table lists the nonsupported logical operators and their equivalent ColdFusion
operators:
Nonsupported
Equivalent ColdFusion
logical operator
decision operator
=
IS, EQUAL, EQ
<
LT, LESS THAN
<=
LTE, LE,
LESS THAN OR EQUAL TO
>
GT
GREATER THAN
my_first_name
and
my_last_name
5
and
variables.my_age
to the string literal
is assigned to age.
are not surrounded by
.
the_string
Description
Tests for equality.
Tests for less than.
Tests for less than or equal to.
Tests for greater than.
Working with CFML expressions
. Further,
Kaleigh
Smith
and
,
Kaleigh
5
operator to test
IS
25

Advertisement

Table of Contents
loading
Need help?

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents