
246
Chapter 13 Extending ColdFusion Pages with CFML Scripting
if-else:
if(expr) statement [else statement] ;
if(score GT 1)
result = "positive";
else
result = "negative";
for loop:
for (init-expr ; test-expr ; final-expr) statement ;
init-expr and final-expr 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-expr can be one of the following:
•
Any ColdFusion expression, for example, A LT 5, loop LE x, or Y EQ "not found"
AND loop LT end
•
Empty
Here are some examples of for loops:
for(Loop=1;
Loop LT 10;
Loop = Loop + 1)
a[loop]=loop;
// Complete for loop in a single line.
for(loop=1; loop LT 10; loop=loop+1)a[loop]=loop;
// Use braces to indicate multiple statements to loop over
for( ; ; )
{
indx=indx+1;
if(Find("key",strings[indx],1))
break;
}
while loop:
while (expr) statement ;
// Use braces to note the code to loop over
a = ArrayNew(1);
loop = 1;
while (loop LT 10)
{
a[loop] = loop + 5;
loop = loop + 1;
}
Содержание 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 ...