Contents

cfloop

Description

Looping is a very powerful programming technique that lets you repeat a set of instructions or display output repeatedly until one or more conditions are met. cfloop supports five types of loops.

Category

Other

Implemented

Usage Syntax

<cfloop  
	[index="String"]
	[from="number"]
	[to="number"]
	[step="number"]
	[condition="String"]
	[query="String"]
	[startRow="number"]
	[endRow="number"]
	[list="String"]
	[array="Array"]
	[delimiters="String"]
	[collection="Any"]
	[item="String"]
	[file="String"]
	[characters="number"]
	[startline="number"]
	[endline="number"]
	[charset="String"]
 />

[] = Optional attribute

Attributes

Name Type Required Default Description
index String No Index value. ColdFusion sets it to from value and increments or decrements by step value, until it equals to value.
from number No Beginning value of index.
to number No Ending value of index.
step number No Step by which to increment or decrement the index value.
condition String No Condition that controls the loop.
query String No Query that controls the loop.
startRow number No First row of query that is included in the loop.
endRow number No Last row of query that is included in the loop.
list String No A list, variable, or file name; contains a list
array Array No
delimiters String No Character(s) that separates items in list
collection Any No Collection to loop over
item String No Key for the collection
file String No file path
characters number No
startline number No start line
endline number No end line
charset String No charset for read the file

Example Usage