From: matz@... (Yukihiro Matsumoto) Date: 2001-11-10T03:32:05+09:00 Subject: [ruby-talk:24786] Re: Strange behaviour of Array#[] Hi, In message "[ruby-talk:24773] Re: Strange behaviour of Array#[]" on 01/11/10, "Lyle Johnson" writes: |> I believe it's for consistency with Strings: | |This is still pretty squirrelly to me, but hey, it's not my language ;) For these methods, each index points at the edge between elements. Suppose we have array = [0, 1, 2, 3], -4 -3 -2 -1 +---+---+---+---+ | 0 | 1 | 2 | 3 | +---+---+---+---+ 0 1 2 3 4 when the index is not pointing existing edge, array[idx, n] returns nil (in this case, idx < -4 or 4 < idx). Index 4 points the last edge of the array, so it does return a subarray, which is an empty array since there's no element after the last edge. matz.