should it not be month = month+1
I think you were in a infinite loop before


<cfscript>
        year=2004;
        for(month=1; month lte 12; month = month+1){
                for(day=1; day lte daysinmonth(createdate(year,month,1));
day = day+1){
                        writeoutput(createdate(year,month,day)&"<br>");
                }
        }
</cfscript>

Taco Fleur
Blog  <http://www.tacofleur.com/index/blog/>
http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/
0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn

-----Original Message-----
From: Ubqtous [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 27 January 2004 3:11 PM
To: CF-Talk
Subject: nested 'for' loop performance

CF-Talk,

I am messing around trying to output the days of a given year. Using
CFLOOP the results are displayed in a second or two:

<cfset year=2004>
<cfloop from="1" to="12" index="month">
        <cfloop from="1" to="#daysinmonth(createdate(year,month,1))#"
index="day">
                <cfoutput>#createdate(year,month,day)#</cfoutput><br>
        </cfloop>
</cfloop>

However, using what appears to be the equivalent in CFSCRIPT times out
despite a generous ?requesttimeout=500:

<cfscript>
        year=2004;
        for(month=1; month lte 12; month+1){
                for(day=1; day lte daysinmonth(createdate(year,month,1));
day+1){
                        writeoutput(createdate(year,month,day)&"<br>");
                }
        }
</cfscript>

I am assuming that I have made a stupid mistake, but I can't see
it--why are the nested 'for' loops performing so poorly?

CF5, if it matters.

~ Ubqtous ~
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to