From: Devi Web Development Date: 2007-10-26T05:10:15+09:00 Subject: Re: Intervals in Ruby On 10/25/07, Just Another Victim of the Ambient Morality wrote: > > What i find strage about ranges is that: > > (0..3).to_a # => [0, 1, 2, 3] > > but > > (3..0).to_a # => [] > > I find this strange, as well... > Aside from breaking many lines of code, how bad would it be to change > it? Ranges are based upon comparisons of what is less than something else. In fact, if I recall correctly, to generate an array (Range#to_a) calls next on the start of the range until it reaches the end of the range. With your range (3..0) it would go [3,4,5...Infinity], so ruby opts to produce an empty array. ------------------------------------------- Daniel Brumbaugh Keeney Devi Web Development Devi.WebMaster@gMail.com -------------------------------------------