Forum: Ruby Accessing array by slicing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Roy B. (Guest)
on 2017-03-20 15:09

array = [A,B,C,D]

array[1]  => B
array[3] => D

array[1,2] => [B,C]
array[0,3] => [A,B,C]

Why does array[4,0] return [], yet array[5,0] returns nil?

Both should be out of bounds.
This topic is locked and can not be replied to.