>> It's the way index-based loops work.
I am afraid that the way you described is not the way they work. The
condition is evaluated before the loop starts and only commences if the
condition is met. So <cfloop from="1" to="0" index="j"> will not run at
all.
>> Do you ever manipulate somearray inside the loop?
That should not matter. The condition is evaluated once at the beginning of
the loop. You can see this by running this code.
<cfset x=1>
<cfloop from="1" to="#x#" index="j">
<cfoutput>#j#</cfoutput>/
<cfif j eq 1>
<cfset x=3>
</cfif>
</cfloop>
OUTPUT = 1/
X is evaluated at the start of the loop and not looked at again for the
duration.
>> I have a query on looping in coldfusion. Why does the below loop run
twice?
I suspect that the loop is either being called twice or your variable
"#ArrayLen(somearray)# does in fact equal 2.
Dennis Powers
UXB Internet - A website Design and Hosting Company
P.O. Box 6028, Wolcott, CT 06716 - T:203-879-2844
W: http://www.uxbinternet.com
W: http://www.ctbusinesslist.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:354760
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm