S
Stefano Grioni
Hello everybody.
I just noticed a behavior I don't really get related to Range and
Enumerator.
if I write down something like (1..4).each { |i| p i=C2=A0} , this will p=
rint
1234
However, if I write (4..1).each { |i| p i=C2=A0}, nothing will be printed=
out
despite 4..1 is a valid range.
Can anyone explain me why this strange behavior is implemented as such,
and how can I circle that without the need to use the very ugly
1..4).each { |i| p (4-i)=C2=A0} ?
Thanks a lot for your answer,
Best regards
-- =
Posted via http://www.ruby-forum.com/.=
I just noticed a behavior I don't really get related to Range and
Enumerator.
if I write down something like (1..4).each { |i| p i=C2=A0} , this will p=
rint
1234
However, if I write (4..1).each { |i| p i=C2=A0}, nothing will be printed=
out
despite 4..1 is a valid range.
Can anyone explain me why this strange behavior is implemented as such,
and how can I circle that without the need to use the very ugly
1..4).each { |i| p (4-i)=C2=A0} ?
Thanks a lot for your answer,
Best regards
-- =
Posted via http://www.ruby-forum.com/.=