Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Nathan Strutz / Nathan Strutz (Nathan Strutz)
Created: 10/04/2012
Components: Language
Versions: 10.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: Final /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Platforms All
Vote Count: 1
When I am looping over something, such as a file, with cfloop, I often need a loop index. This either forces me to create a manual index, adding +1 on each iteration, or I have to change the type of loop to a for loop with an explicit index. It would be a great benefit if I there were a variable, such as #cfloop.index#, that would always reference the current-scoped loop, and would disappear when out of the loop scope.
Code example:
<cfset myArray = ["a","b","c"]>
<cfloop array="#myArray#" index="myArrayValue>
Number #cfloop.index# value is #myArrayValue#<br>
</cfloop>
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3341256
External Customer Info:
External Company:
External Customer Name: mrnate
External Customer Email:
External Test Config: My Hardware and Environment details: Any
Attachments:
Comments: