Reverse For Loop Syntax

Discussion in 'ASP General' started by Adrienne Boswell, Aug 9, 2006.

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

    --
    Adrienne Boswell at work
    Administrator nextBlock.com
    http://atlas.nextblock.com/files/
    Please respond to the group so others can share
    Adrienne Boswell, Aug 9, 2006
    #1
    1. Advertising

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





    "Adrienne Boswell" <> wrote in message
    news:...
    > 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.
    >
    > --
    > Adrienne Boswell at work
    > Administrator nextBlock.com
    > http://atlas.nextblock.com/files/
    > Please respond to the group so others can share
    >
    Aaron Bertrand [SQL Server MVP], Aug 9, 2006
    #2
    1. Advertising

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



    >
    > "Adrienne Boswell" <> wrote in message
    > news:...
    > > 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.
    > >
    > > --
    > > Adrienne Boswell at work
    > > Administrator nextBlock.com
    > > http://atlas.nextblock.com/files/
    > > Please respond to the group so others can share
    > >
    Adrienne Boswell, Aug 9, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dogbite
    Replies:
    4
    Views:
    678
    osmium
    Oct 10, 2003
  2. Alex Snast
    Replies:
    16
    Views:
    2,135
    Alex Snast
    Sep 21, 2008
  3. R. Rajesh Jeba Anbiah

    for in loop. reverse traverse

    R. Rajesh Jeba Anbiah, Dec 9, 2004, in forum: Javascript
    Replies:
    3
    Views:
    153
    Grant Wagner
    Dec 14, 2004
  4. tuser
    Replies:
    2
    Views:
    215
    DJ Stunks
    Jun 12, 2006
  5. Isaac Won
    Replies:
    9
    Views:
    348
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page