I am working through a book which gives examples of Ranges being converted to equivalent arrays using their \"to_a\" methods
When i run the code in irb I get the fol
I just tried to use ranges from bigger to smaller amount and got the result I didn't expect:
irb(main):007:0> Array(1..5) => [1, 2, 3, 4, 5] irb(main):008:0> Array(5..1) => []
That's because of ranges implementations. So I had to use the following option:
(1..5).to_a.reverse