Adobe COLDFUSION 9 Manual page 121

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
• The
statement does not have to follow all
default
so. If any
statements follow the
switch
statement.
• The
statement is not required. However, use one if the
default
of the expression.
• The
statement does not have to follow all the
default
to place it there.
The following
statement takes the value of a name variable:
switch
If the name is John or Robert, it sets both the male variable and the found variable to True.
1
If the name is Mary, it sets the male variable to False and the found variable to True.
2
3
Otherwise, it sets the found variable to False.
switch(name) {
case "John": case "Robert":
male=True;
found=True;
break;
case "Mary":
male=False;
found=True;
break;
default:
found=False;
} //end switch
Using looping statements
CFScript provides a richer selection of looping constructs than those supplied by CFML tags. It enables you to create
efficient looping constructs like those in most programming and scripting languages. CFScript provides the following
looping constructs:
• For
• While
• Do-while
• For-in
CFScript also includes the
continue
Using for loops
The for loop has the following format:
for (initial-expression; test-expression; final-expression) statement
The initial-expression and final-expression can be one of the following:
• A single assignment expression; for example, x=5 or loop=loop+1
• Any ColdFusion expression; for example, SetVariable("a",a+1)
• Empty
The test-expression can be one of the following:
• Any ColdFusion expression; for example:
statements, but it is good programming practice to do
switch
statement you must end the
default
statements; however, it is good programming practice
case
and
statements that control loop processing.
break
Last updated 8/5/2010
block code with a
default
constants do not include all possible values
case
116
break

Advertisement

Table of Contents
loading

Table of Contents