From: Gavin Sinclair Date: 2012-07-07T12:32:18+09:00 Subject: Strange behaviour when selecting range of elements from an array? --00151761c7aadc312404c43506b9 Content-Type: text/plain; charset=ISO-8859-1 (1) a = [:x, :y, :z] => [:x, :y, :z] (2) a[2..-1] => [:z] (3) a[3..-1] => [] (4) a[4..-1] => nil (5) a[5..-1] => nil (6) a[6..-1] => nil I consider line (3) to be the odd one out here. Given a[3] returns nil, why shouldn't a[3..-1] also return nil? Gavin --00151761c7aadc312404c43506b9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
(1) =A0a =3D [:x, :y, :z] =A0 = =A0=3D> [:x, :y, :z]
(2) =A0a[2..-1] =A0 =A0 =A0 =A0 =A0 =A0=3D> [:z]
(3) =A0a[3..-1] =A0 =A0 =A0 =A0 =A0 =A0= =3D> = []
(4) =A0a[4..-1] =A0 =A0 =A0= =A0 =A0 =A0=3D> nil
(5) =A0a[5..-1] =A0 =A0 =A0 =A0 =A0 =A0=3D> nil
(6) =A0a[6..-1] =A0 = =A0 =A0 =A0 =A0 =A0=3D> nil

I consider line (3) to be the odd one out here. =A0Given = a[3] returns nil, why shouldn't a[3..-1] also return nil?
Gavin
--00151761c7aadc312404c43506b9--