D
Dominic Marks
Hello,
I was surprised of to find this behaviour:
irb(main):008:0> a, b = 1, 100
=> [1, 100]
irb(main):009:0> (a..b).to_a.length
=> 100
irb(main):010:0> (b..a).to_a.length
=> 0
Now I am aware that only a simple .reverse is required to work
around this but this seemed a little un-ruby like. Is there
some thoughtful reason to not have ranges in both
directions that I'm missing?
Cheers,
Dominic
I was surprised of to find this behaviour:
irb(main):008:0> a, b = 1, 100
=> [1, 100]
irb(main):009:0> (a..b).to_a.length
=> 100
irb(main):010:0> (b..a).to_a.length
=> 0
Now I am aware that only a simple .reverse is required to work
around this but this seemed a little un-ruby like. Is there
some thoughtful reason to not have ranges in both
directions that I'm missing?
Cheers,
Dominic