Ranges use <=>
to determine if an iteration is over; 5 <=> 1 == 1
(greater-than), so it's done before it starts. Even if they didn't, ranges iterate using succ
; 5.succ
is 6
, still out of luck. A range's step
cannot be negative, so that won't work either.
It returns the range because each
returns what it was called on. Use downto
if it's the functionality itself you're looking for, otherwise the above answers your actual question regarding "why".