Skip to main content

ASP Reverse For Loop

It's kind of interesting of how reverse linking does not seem so obvious in classic ASP.  You would think that it would be along the lines of:

dim i
for i = 30 to 2
  'code comes here
next


but it's not.  To have a reverse For loop it's:

dim i
for i = 30 to 2 Step-1
  'code comes here
next


That's right that small bit (Step-1) makes all the difference.  I stumbled upon this by chance and thought that someone would benefit from this.

Happy coding.

Blogged with Flock

Comments

Anonymous said…
Brilliant!! i always wanted to know how to do this and now i do! thanks!!!