From: Christian Neukirchen Date: 2007-02-20T03:41:31+09:00 Subject: Re: For loops don't count down "Martin DeMello" writes: > On 2/19/07, Harry wrote: >> > >> I never use 'for' loops in Ruby. So I can't explain if or why not, etc. > > "for x in xs" translates internally to "xs.each do |x|", so the > underlying problem is that Range#each only counts upwards. That's not entirely true (there are differences in scope), but the behavior of #each matters here, yes. Ranges can't be reversed in general, because there is no backward equivalent to #succ. > martin -- Christian Neukirchen http://chneukirchen.org