| ▲ | saghm 2 hours ago | |
Yeah, returning an empty array is pretty much exactly what I would expect given the first example. It would be a lot weirder to me if you were allowed to give an end index past the last element only if the array happened to be non-empty. | ||
| ▲ | bradchris 2 hours ago | parent [-] | |
Especially because in ruby [0, nil, nil, nil, …x100, nil] is the same as [0] in terms of access. In both cases, trying to access the 100th element (e.g. [0][100]) will give nil. | ||