Looks like your incrementing X in the for statement and in the body of the
loop


On Thu, Apr 24, 2014 at 8:55 AM, Byron Mann <[email protected]> wrote:

>
> Am i missing something obvious.
>
> <cfoutput>
>
> <cfset t = 1>
> <cfloop condition="t LTE 10">
> t=#t#<BR>
> <cfset t++>
> <cfif t GT 10>
> <cfbreak/>
> </cfif>
> </cfloop>
> <cfset w = 1>
> <cfloop condition="1 eq 1">
> w=#w#<BR>
> <cfset w++>
> <cfif w GT 10>
> <cfbreak/>
> </cfif>
> </cfloop>
>
> <cfloop from=1 to=10 index=y>
> y=#y#<BR>
> <cfset y++>
> </cfloop>
>
> <cfscript>
> for(x=1; x <= 10; x++){
>
> writeOutput(x & "<BR>");
> x++;
>
> }
> writeOutput(x);
> </cfscript>
> </cfoutput>
>
>
> t=1
> t=2
> t=3
> t=4
> t=5
> t=6
> t=7
> t=8
> t=9
> t=10
> w=1
> w=2
> w=3
> w=4
> w=5
> w=6
> w=7
> w=8
> w=9
> w=10
> y=1
> y=2
> y=3
> y=4
> y=5
> y=6
> y=7
> y=8
> y=9
> y=10
> 1
> 3
> 5
> 7
> 9
> 11
>
> Only the last version is working as I would expect. I ran into this
> attempting to increment an index inside cfloop, so I could skip a few
> records in an array.
>
> I can't believe I've never noticed this, or am I just plain nuts?
>
> Byron Mann
> Lead Engineer & Architect
> HostMySite.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:358395
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to