From: Guest Date: 2006-04-22T05:41:34+09:00 Subject: Re: Newbie questoin of the day:A for loop that counts backwa MenDAKE wrote: > How do I get a for loop to count backwards? > > I have the loop... > > for i in 1 ... 8 > > ...but I want it to start at 8 and end at 1. This does NOT work: > > for i in 8 ... 1 > > Thanks for helping out a newbie. I like doing it this way... it makes more sense to me: x = 8 while x > 0 x = x-1 puts x end -- Posted via http://www.ruby-forum.com/.