From: Daniel Berger Date: 2005-07-22T23:00:57+09:00 Subject: Re: Odd Array#[x..y] return values David A. Black wrote: > Hi -- > > On Fri, 22 Jul 2005, daz wrote: > > > > > Daniel Berger wrote: > >> Hi all, > >> > >> Ruby 1.8.2 > >> > >> Consider: > >> > >> irb(main):001:0> a = [] > >> => [] > >> irb(main):002:0> a[0..1] > >> => [] > >> irb(main):003:0> a[-2..-1] > >> => nil > >> > >> Why does the first return [] and the second return nil? > >> > > > > > > Archive reading: > > http://groups.google.com/groups?threadm=BAY22-F7pSWerOc0Ne000000288@hotmail.com > > I'll perhaps superfluously report the results of my digging, as long > as I've done it :-) See the ruby-talk threads starting at: > > 10136 > 24700 > 84973 > > In the first of these, Matz talks about the index pointing at an > (imaginary) edge between elements. > > > David Thanks David and Daz. Maybe this should go in the FAQ. :) Regards, Dan