Reverse For Loop Syntax

Reverse For Loop Syntax

Post by Adrienne B » Fri, 11 Aug 2006 05:08:08


Today, I am braindead... I can't seem to find this in Google, and I
don't remember where I used this code before (so I can't steal it from
myself). Anyway, all I want to do is:

for i = 0 to 20 step -1
response.write "<br>" & i
next

For some reason, that doesn't work. It shows nothing. I know I am
missing something very simple, but, as I said, today, I am braindead.
 
 
 

Reverse For Loop Syntax

Post by Aaron Bert » Fri, 11 Aug 2006 05:16:56

Uh, did you mean for i = 20 to 0 step -1?

If you're going -1 each step, and you start at 0, you're not going to get
too far.

 
 
 

Reverse For Loop Syntax

Post by Adrienne B » Fri, 11 Aug 2006 05:42:46


Aaron Bertrand [SQL Server MVP] wote:

<slaps forehead>Oh my Gosh! Doh! I knew it was something simple.</slap>

Thank you sooo much.