ColdFusion Loops cfloop

COM Collection/Structure Loops

You can loop over a Structure or COM collection.

<cfset myBooks = StructNew()>
<cfset myVariable = StructInsert(myBooks,"ColdFusion","ColdFusion MX Bible")>
<cfset myVariable = StructInsert(myBooks,"HTML","HTML Visual QuickStart")>
<cfset myVariable = StructInsert(myBooks,"XML","Inside XML")>
<cfloop collection="#myBooks#" item="subject">
  <cfoutput>
 <b>#subject#:</b> #StructFind(myBooks,subject)#<br />
 </cfoutput>
</cfloop>

Display in browser:
ColdFusion: ColdFusion MX Bible
HTML: HTML Visual QuickStart
XML: Inside XML
via ColdFusion Loops cfloop.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.