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
  • 226,338
  • 43
  • 373
  • 367
Vitaliy Yanchuk
  • 1,463
  • 1
  • 11
  • 22

0 Answers0