Not exactly. You can do a foreach style loop over a structure, but even then
you are limited to looping over the key names rather than their values:

<cfloop collection="#myStruct#" item="myKey">
<cfoutput>#myStruct[myKey]#</cfoutput>
</cfloop>

Or...

<cfscript>
for (myKey in myStruct) {
writeOutput(myStruct[myKey]);
}
</cfscript>

There's no similar syntax for looping over the elements of an array. You're
limited to a for loop with arrays.

Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057

________________________________________
From: Damien McKenna [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 11:58 AM
To: CF-Talk
Subject: "foreach"?

Is there any way to do a foreach-type loop in CFML?
--
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
"Nothing endures but change." - Heraclitus
________________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to