Looping Over a Structure Using Cfscript
Stumbled across this little bit of code, that shows how to loop over a structure using <cfscript>.
[code]
// create the structure
strProducts = StructNew();
// populate the structure
strProducts.Name = “Core ColdFusion 5”;
strProducts.Price = “44.95”;
strProducts.ISBN = “0119299377”;
// loop over it and output the key-value pair
for (idx in strProducts) {
WriteOutput(“#idx# is #strProducts[idx]#”);
}
[/code]