The following example increments the parameter "CountVar" from 1 to 5. The results look exactly like the Index loop example.
<!--- Set the variable CountVar to 0 --->
<CFSET CountVar=0>
<!--- Loop until CountVar = 5 --->
<CFLOOP CONDITION="CountVar LESS THAN OR EQUAL TO 5">
<CFSET CountVar=CountVar + 1>
The loop index is <CFOUTPUT>#CountVar#</CFOUTPUT>.<BR>
</CFLOOP>
The result of this loop in a browser would look something like:
The loop index is 1.
The loop index is 2.
The loop index is 3.
The loop index is 4.
The loop index is 5.
|