Name

cfloop

Synopsis

[<cfloop index="index_name" from="integer" to="integer" [step="integer"]>]
[<cfloop condition="expression">]
[<cfloop index="index_name" list="list"  [delimiters="delimiters"]>
[<cfloop query="query_name" [startrow="integer"] [endrow="integer"]>]
[<cfloop collection="COM_Object|Structure" item="collection|key">]
  HTML and CFML
</cfloop>

A looping construct that can implement different kinds of looping, depending on the attributes specified. ColdFusion has five basic loop types: index, conditional, list, query, and collection.

Attributes

collection=" COM_Object | Structure "

The collection attribute loops over a COM collection object or a ColdFusion structure. Requires the item attribute and can’t be used with any other attributes.

condition=" expression "

Using the condition attribute creates a while loop that repeats while a specified expression is true. In order to work, the expression being tested must change with each iteration until the condition evaluates to false. Can’t be used with any other attributes.

delimiters=" delimiters "

The characters used to separate items in the list. Optional. The default delimiter is a comma.

endrow=" integer "

Row to stop looping. Optional. By default, ColdFusion continues the loop until it reaches the end of the record set.

from=" integer "

Number specifying the beginning value for the loop. Required when index is used to loop through a range of values.

index=" index_name "

Using the index attribute creates a for loop. ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.