
The CFScript Language
247
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)
{
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 ;
variable can be any ColdFusion identifier, and collection must be the name of an
existing ColdFusion structure.
for (x in mystruct) mystruct[x]=0;
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...