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/
Google+:  http://plus.google.com/113032480415921517411



On Fri, Mar 1, 2013 at 11:46 AM, funand learning <[email protected]>wrote:

>
> I am sorry, I wasn't clear. the "to" is arraylen. Sometimes the arraylen is
> 1
>
> <cfloop from="1" to="#ArrayLen(somearray)# index="j">
>
> </cfloop>
>
> <cfoutput>#j#</cfoutput> ----------this returns 2
>
> On Thu, Feb 28, 2013 at 6:34 PM, Phillip Vector
> <[email protected]>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
> > <[email protected]> wrote:
> > >
> > > I have a query on looping in coldfusion.Why does the below loop run
> > twice?
> > >
> > > <cfloop from="1" to="1" index="j">
> > >    <cfoutput>#j#</cfoutput>
> > > </cfloop>
> > >
> > > I thought the above code should return only 1, but it returns 1 2
> > >
> > >
> >
> >
>
> 

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

Reply via email to