Perhaps it only happened with qiery loops then
Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On Mar 1, 2013 10:00 PM, "Adam Cameron"
wrote:
>
> On 1 March 2013 12:45, Russ Michaels wrote:
>
> >
> > Have don
On 1 March 2013 12:45, Russ Michaels wrote:
>
> Have done so many times, many years ago thus how.discovered the issues.
> Unless it got fixed in current versions.
>
Sorry mate, you're just mistaken.
I dunno how far back you want to go, but I ran this code on CFMX7:
Before
Within: #i#
A
>> 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 will not run at
all.
>> Do you ever manipulate somearray inside the loop?
That should not
Have done so many times, many years ago thus how.discovered the issues.
Unless it got fixed in current versions.
Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On Mar 1, 2013 12:36 PM, "Adam Cameron"
wrote:
>
Sure. But you *don't need to*. deals with it.
--
Adam
On 1 March 2013 12:38, Russ Michaels wrote:
>
> Also it is quite easy to test if the dynamic.value will be above zero.
>
> E.g
>
>
> Do loop
>
> Do something else
>
>
> Regards
> Russ Michaels
> www.michaels.me.uk
> www.cfmldeveloper.c
Also it is quite easy to test if the dynamic.value will be above zero.
E.g
Do loop
Do something else
Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On Mar 1, 2013 12:26 PM, "Adam Cameron"
wrote:
>
> On 1
Just run the code & see, mate.
On 1 March 2013 12:34, Russ Michaels wrote:
>
> Yes Adam it does, I had to change much code back in the day due to that
> very issue.
>
~|
Order the Adobe Coldfusion Anthology now!
http://www.am
Yes Adam it does, I had to change much code back in the day due to that
very issue.
Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On Mar 1, 2013 12:26 PM, "Adam Cameron"
wrote:
>
> On 1 March 2013 08:37, Rus
On 1 March 2013 08:37, Russ Michaels 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
Because your output is on the outside of the loop, therefore 2 is expected.
That is not an indication your loop is running twice, and to confirm that
you will need to put the output inside the loop and you will see a big
difference.
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Goog
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.
I have never had an issue with an interation of 1 running twice though,
that I have noticed anyway.
Regards
Russ Michaels
>
> Do you ever manipulate somearray inside the loop? I am not sure if
> #ArrayLen(somearray)# is evaluated once or at each looping.
>
The expressions passed to tags are evaluated first, then passed into the
tag code. So in this case it's not the expression "arrayLen(someArray)"
that's passed int
> I've never used the loop index, and I don't think you should depend on it.
> Not sure what documented behavior is, but if it isn't documented in a
> specific way, it would be totally appropriate for it to go out of scope in
> a future version (kinda surprised it doesn't)
>
> Instead, use your ow
It's the way index-based loops work. At the first pass of the , the
INDEX variable is created with the initial value, and the condition (in
this case the condition is an implicit "index variable value <= TO value").
If the condition is true, the loop block is entered. At the bottom of the
loop blo
for (var j = 1; local.j lte ArrayLen(local.somearray); local.j++) {
WriteOutput(local.j);
}
Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer
http://cutterscrossing.com
Co-Author "Learning Ext JS 3.2" Packt
PM
To: cf-talk
Subject: Re: question on cfloop
I am sorry, I wasn't clear. the "to" is arraylen. Sometimes the arraylen is
1
#j# --this returns 2
~|
Order the Adobe Coldfusion Anthology now!
http:/
Not sure, but I believe the index at loop completion is incremented - that's
how it knows how to stop. So it's similar to
j=1;
while(j<2) {
j++;
}
I've never used the loop index, and I don't think you should depend on it. Not
sure what documented behavior is, but if it isn't document
I am sorry, I wasn't clear. the "to" is arraylen. Sometimes the arraylen is
1
#j# --this returns 2
On Thu, Feb 28, 2013 at 6:34 PM, Phillip Vector
wrote:
>
> Why are you looping from 1 to 1? That isn't a loop.
>
> On Thu, Feb 28, 2013 at 7:22 PM, fun and learning
> wrote:
> >
> > I
not on Railo 4
is this the whole script?
is it in at Custom Tag?
On 1 March 2013 08:22, fun and learning wrote:
>
> I have a query on looping in coldfusion.Why does the below loop run twice?
>
>
>#j#
>
>
> I thought the above code should return only 1, but it returns 1 2
>
>
~~
Why are you looping from 1 to 1? That isn't a loop.
On Thu, Feb 28, 2013 at 7:22 PM, fun and learning
wrote:
>
> I have a query on looping in coldfusion.Why does the below loop run twice?
>
>
>#j#
>
>
> I thought the above code should return only 1, but it returns 1 2
>
>
~~~
20 matches
Mail list logo