On 22/02/2019 15:57, Tim Mackinnon wrote:
I've just been caught out with Intervals - why can't you do:
5 to: 1 do: [ :i | Transcript show: i printString] (eg a negative interval)?
if you want to iterate down a series of numbers do you really have to do:
5 to: 1 by: -1 do: […
I always assumed that if x > y the step was automatically -1 (but its not).
Expectations are obviously personal, but as far as I am concerned, I'd
expect to see the behavior that Pharo implements. If you don't specify
by:, you get a default value of 1. That's much simpler than a default
value depending on the bounds of the interval.
Konrad.