Reverse For Loop Syntax

  • Thread starter Adrienne Boswell
  • Start date
A

Adrienne Boswell

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.
 
A

Aaron Bertrand [SQL Server MVP]

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.
 
A

Adrienne Boswell

Aaron Bertrand [SQL Server MVP] wote:
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.

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

Thank you sooo much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top