最佳答案
I tried to iterate backwards with using a Range and each
:
(4..0).each do |i|
puts i
end
==> 4..0
Iteration through 0..4
writes the numbers. On the other Range r = 4..0
seems to be ok, r.first == 4
, r.last == 0
.
It seems to be strange to me that the construct above does not produce the expected result. What is the a reason for that? What are the situations when this behaviour is reasonable?