1

What is the logic behind below results:

a = []
a[0..2] # => []
a[1..2] # => nil

I would expect the last example to also return empty array, why is it different?

Sergio Tulentsev
  • 219,187
  • 42
  • 361
  • 354
Vitaliy Yanchuk
  • 1,443
  • 1
  • 11
  • 21

0 Answers0