Home > Products > ColdFusion > Support > Getting Started with ColdFusion
ColdFusion Icon Macromedia ColdFusion Support Center - Getting Started with ColdFusion
Using quotation marks in CFML

In ColdFusion, you can use quotation marks to assign text-based values to variables or to identify string data. ColdFusion interprets the data between the quotation marks as a literal value, and assigns that value to the results. You can use single- or double-quotation marks to flag string data or assign text-based values to variables. For example, to flag string data in a CFML expression, you surround the text with single- or double-quotation marks:

-'This is a test page.-'

Even though one string is enclosed with double-quotation marks and the other sting is enclosed with single-quotation marks, ColdFusion interprets the characters between both sets of quotation marks as literal text.

Guidelines for using quotation marks
Follow these guidelines when using quotation marks:

Use single- or double-quotation marks to flag string data. String data can consist of any arbitrary series of characters (letters, numbers, punctuation, spaces, or other printable characters).
Use single- or double-quotation marks when assigning literal text-based values to variables. Always use quotation marks on the right side of the equal sign, for example: <cfset TheString = " Hello, Kaleigh!">
Do not use quotation marks to assign numeric-based values to variables. Numeric-based variables values do not require quotation marks.

Examples of using quotation marks
The following sections describe some of the ways that you can use quotation marks in CFML.

Flagging literal data strings
You can put strings of data in your ColdFusion expressions by enclosing the data with quotation marks.

Example Description
<cfset color = "red">

cfset assigns the literal red with the variable color.

<cfset firstname = Ucase("brent")>



ColdFusion evaluates the expression and returns the uppercase of the literal. In this case the value returned to the browser is BRENT.

Assigning text-based variable values
You can assign text-based values to a variable by enclosing the value with quotation marks.

Example Description
<cfset my_name = "Kaleigh Smith"> In this example, ColdFusion instantiates the variable my_name to the literal text-based string Kaleigh Smith.

To Table of Contents Back to Previous document Forward to next document