Looping over a list lets you step through elements contained in a variable or value that is returned from an expression. In a list loop, the index attribute specifies the name of a variable to receive the next element of the list, and the list attribute holds a list or a variable that contains a list.
<cfloop index = "index_name" list = "list_items" delimiterS = "item_delimiter"> </cfloop>
cfabort, cfbreak, cfexecute, cfexit, cfif cfelseif cfelse, cflocation, cfswitch cfcase cfdefaultcase, cfthrow, cftry cfcatch
This loop displays the names of each of the Beatles:
<cfloop index = "ListElement"
list = "John,Paul,George,Ringo">
<cfoutput>#ListElement#</cfoutput><BR>
</cfloop>
Although the default delimiter character is a comma, you can specify element boundaries in the delimiter attribute. Here's the same loop as before, but in this example cfloop treats commas, colons, or slashes as list element delimiters:
<cfloop index = "ListElement"
list = "John/Paul,George::Ringo"
delimiters = ",:/">
<cfoutput>#ListElement#</cfoutput><BR>
</cfloop>
Delimiters can be specified in any order. Consecutive delimiters are treated as a single delimiter; thus the two colons in the previous example are treated as a single delimiter between "George" and "Ringo."