Chapter 20: Extending ColdFusion Pages with CFML Scripting
341
do-while loop:
do statement while (expr) ;
// Complete do-while loop on a single line
a = ArrayNew(1);
do {a[loop1] = loop1 + 5; loop1 = loop1 + 1;} while (loop1 LT 10);
// Multiline do-while loop
a = ArrayNew(1);
do
{
a[loop1] = loop1 + 5;
loop1 = loop1 + 1;
}
while (loop1 LT 10);
switch-case:
switch (expr) {case const-expr : statement break ; default : statement }
In this syntax, const-expr must be a constant (i.e., not a variable, a function, or other
expression). Only one default statement is allowed. There can be multiple case
statements. You cannot mix Boolean and numeric case values in a switch statement.
No two constants may be the same inside a switch statement.
switch(name)
{
case "John":
{
male=true;
found=true;
break;
}
case "Mary":
{
male=false;
found=true;
break;
}
default:
{
found=false;
break;
}
} //end switch
for-in loop:
for (variable in collection) statement ;
Note that variable can be any ColdFusion identifier, and collection must be the name
of an existing ColdFusion structure.
for (x in mystruct) mystruct[x]=0;
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...