MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual page 366

Developing web applications with coldfusion
Table of Contents

Advertisement

340
for loop: for (init-expr ; test-expr ; final-expr) statement ;
Note that 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:
// Multiline for statement
for(Loop1=1;
Loop1 LT 10;
Loop1 = Loop1 + 1);
a[loop1]=loop1;
// Complete for loop in a single line.
for(loop=0; loop LT 10; loop=loop+1)arr[loop]=loop;
// Uses braces to note the code to loop over
for( ; ; )
{
indx=indx+1;
if(Find("key",strings[indx],1))
}
while loop: while (expr) statement ;
// Use braces to note the code to loop over
a = ArrayNew(1);
while (loop1 LT 10)
{
a[loop1] = loop1 + 5;
loop1 = loop1 + 1;
}
a = ArrayNew(1);
while (loop1 LT 10)
{
a[loop1] = loop1 + 5;
loop1 = loop1 +1;
}
break;
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents