On 1 March 2013 08:37, Russ Michaels <r...@michaels.me.uk> wrote: > > The.simple answer is, only use an index loop where there is more than 1 > iteration. It will always run once even if the loop is 0, because it has to > run once to find that out. >
Nah, the condition is checked, but the code within the loop is not run even once if the condition is not met: <cfoutput> Before<br> <cfloop index="i" from="1" to="0"> Within: #i#<br> </cfloop> After #i#<br> </cfoutput> Output: Before After 1 As per the OP's situation, if the TO value is dynamic, one doesn't always know whether the loop will run zero, one or more times. So to say one should only use a loop when there's more than one iteration is a bit unreasonable. Anyway, the looping construct works fine no matter what combination of FROM/TO values you give it, so as long as you know how the thing works, it's safe to use it however one wants to. -- Adam ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354753 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm