OK, me==dah, the first 2 examples I just need to increment by 2 (or any
other factor) other than 1. This is what happens without enough coffee.

My actual code in use was like the 3rd example, but it is nested inside
other loops. I had to break the inner loop in differing steps/increments.
Something like this....

<cfloop from=1 to="#arrayLen(ary)#" index='x'>
...
<cfloop from="#x#" to='#arrayLen(ary)# index='y'>
....
<cfset x=x+{various value}> <!-- skip this many now --->

Suffice to say, it was easy enough to fix once I modified to a "for"
statement and understood what was going on. Just looking at the code for 2
hours and thinking "THIS SHOULD WORK" was what got me about it all.

I guess in 15 years of CF I've really just never done this or have done by
other means. Just seems perplexing that this particular incarnation would
act differently. I'll add it to the CF quirky list I have in my head.

Thanks everyone for taking a look,
~Byron





On Thu, Apr 24, 2014 at 1:49 PM, Andrew Scott <andr...@andyscott.id.au>wrote:

>
> They are all working the way they are intended, but I will look at one in
> particular as it can catch a lot of people out.
>
> <cfloop from=1 to=10 index=y>
> y=#y#<BR>
> <cfset y++>
> </cfloop>
>
> When ColdFusion does any looping like this, the y is reset to the actual
> loop valuem hence making the manual increment mute. If you want it to step
> in lots of 2 then use the step attribute to do this.
>
> As for the first example, what a frigging mess but it does exactly what you
> are telling it to do.
>
> The problem with cfscript is that it is more ESMAC compliant, which means
> you can increment it when being used in a for loop as you have shown in
> your last example.
>
> Regards,
> Andrew Scott
> WebSite: http://www.andyscott.id.au/
> Google+:  http://plus.google.com/113032480415921517411
>
>
>
> On Fri, Apr 25, 2014 at 2:28 AM, Byron Mann <byronos...@gmail.com> wrote:
>
> >
> > Yes, that last one with "x" is what I actually want.
> >
> > I'm just surprise the first few versions do not act in the same manner.
> >
> > Byron Mann
> > Lead Engineer & Architect
> > HostMySite.com
> >
> >
> > On Thu, Apr 24, 2014 at 12:25 PM, Blake <wdavi...@gmail.com> wrote:
> >
> > >
> > > Looks like your incrementing X in the for statement and in the body of
> > the
> > > loop
> > >
> > >
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:358406
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to