The CFScript Language
do-while loop: do statement while (expr) ;
// Complete do-while loop on a single line
a = ArrayNew(1);
loop = 1;
do {a[loop] = loop + 5; loop = loop + 1;} while (loop LT 10);
// Multiline do-while loop
a = ArrayNew(1);
loop = 1;
do
{
a[loop] = loop + 5;
loop = loop + 1;
}
while (loop LT 10);
switch-case: switch (expr) {case constant : statement break ; default : statement }
In this syntax, constant must be a constant (that is, not a variable, a function, or other
expression). Only one default statement is allowed. You can use multiple case
statements. You cannot mix Boolean and numeric case values in a switch statement.
No two constants can be the same inside a switch statement.
switch(name)
{
} //end switch
for-in loop: for (variable in collection) statement ;
variable can be any ColdFusion identifier, and collection must be the name of an
existing ColdFusion structure.
for (x in mystruct) mystruct[x]=0;
case "John":
{
male=true;
found=true;
break;
}
case "Mary":
{
male=false;
found=true;
break;
}
default:
{
found=false;
break;
}
247
Need help?
Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?
Questions and answers