Reverse For Loop Syntax

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adrienne Boswell

    Reverse For Loop Syntax

    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

    Please respond to the group so others can share

  • Aaron Bertrand [SQL Server MVP]

    #2
    Re: Reverse For Loop Syntax

    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" <arbpen@yahoo.c omwrote in message
    news:1155154088 .237130.293610@ 75g2000cwc.goog legroups.com...
    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

    Please respond to the group so others can share
    >

    Comment

    • Adrienne Boswell

      #3
      Re: Reverse For Loop Syntax


      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" <arbpen@yahoo.c omwrote in message
      news:1155154088 .237130.293610@ 75g2000cwc.goog legroups.com...
      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

      Please respond to the group so others can share

      Comment

      Working...