There are actually two Ruby range operators. The .. operator is inclusive of the end points and the … operator is exclusive of the high value end point.
a = [0, 1, 2, 3] a[0..-1] => [0, 1, 2, 3] a[0...-1] => [0, 1, 2]
You would think this would be helpful for using a.length for the high end point but it doesn’t seem to matter.
a[0..a.length] => [0, 1, 2, 3] a[0...a.length] => [0, 1, 2, 3]