User Guide

Table Of Contents
The CFScript language 127
Reserved words
In addition to the names of ColdFusion functions and words reserved by ColdFusion expressions
(such as NOT, AND, IS, and so on), the following words are reserved in CFScript. Do not use
these words as variables or identifiers in your scripting code:
Differences from JavaScript
Although CFScript and JavaScript are similar, they have several key differences. The following list
identifies CFScript features that differ from JavaScript:
CFScript uses ColdFusion expressions, which are neither a subset nor a superset of JavaScript
expressions. For example, there is no < operator in CFScript; you use the LT operator instead.
Variable declarations are only used in user-defined functions.
CFScript is case-insensitive.
All statements end with a semicolon and line breaks in the code are ignored.
Assignments are statements, not expressions.
JavaScript objects, such as Window and Document, are not available.
Only the ColdFusion server processes CFScript. There is no client-side CFScript.
CFScript limitation
You cannot include ColdFusion tags in CFScript. However, you can include
cfscript blocks
inside other ColdFusion tags, such as
cfoutput.
CFScript functional equivalents to ColdFusion tags
break default function switch
case do if try
catch else in var
continue for return while
Tag CFScript equivalent
cfset Direct assignment, such as Myvar=1;
cfoutput WriteOutput function
cfif, cfelseif, cfelse if and else statements
cfswitch, cfcase,
cfdefaultcase
switch
, case, and default statements
Indexed
cfloop for loops
Conditional
cfloop while loops and do while loops
Structure
cfloop for in loop. (There is no equivalent for queries, lists, or objects.)
cfbreak break statement. CFScript also has a continue statement that has no
equivalent CFML tag.