From: Frederick Cheung Date: 2008-07-16T01:52:27+09:00 Subject: Re: array ending syntax question On 15 Jul 2008, at 15:07, Alex Gutteridge wrote: > On 15 Jul 2008, at 06:13, Roger Pack wrote: > >> irb(main):001:0> [1,2][2..2] >> => [] >> irb(main):002:0> [1,2][3..3] >> => nil >> >> >> Is this expected? >> the ri says: >> Returns nil if the index (or starting index) are out of range. >> >> does the first example match this? >> Thanks! >> -R > > From the Pickaxe: If the start index equals the array size and a > length or range (as here) parameter is given, an empty array is > returned. > > Not sure why you would want that behaviour though... It sort of makes sense in that in an n item array n is actually a useful index - it's where the next item will go. Fred