#announcements
Title
# announcements
f

Florian

07/08/2019, 11:52 AM
I am trying to figure out why we have IntRange and IntProgression
d

diesieben07

07/08/2019, 11:58 AM
``IntProgression``
can have a step, you could for example iterate from 0 to 10 in steps of 2 (0, 2, 4, 6, 8, 10).
``IntRange``
is an
``IntProgression``
where the step is always 1 and as such represents a closed range.
f

Florian

07/08/2019, 12:02 PM
so the word "Range" implies that no numbers are skipped?
ie no step
d

diesieben07

07/08/2019, 12:03 PM
Yes
The range [0, 10] includes all numbers 0 through 10.
That's why you can do
``5 in 0..10``
but not
``5 in (0..10 step 2)``
Actually you can do that. Huh.
Ah, but the range simply does a check where as the progression needs to loop through all the numbers to see if one matches
f

Florian

07/08/2019, 12:15 PM
makes sense
in a way, ranges are similar to arrays, right?
d

diesieben07

07/08/2019, 12:30 PM
No, a range is really just a start and end element
f

Florian

07/08/2019, 12:36 PM
ok
could you say that it is similar to an array
I mean I get that it generates the actual values in the iterators next function
but it can do a lot of the same things that an array with the same numbers could do
d

diesieben07

07/08/2019, 12:56 PM
That is true, yes. It's an Iterable.
k

karelpeeters

07/08/2019, 5:02 PM
Huh that's stupid, the progressions should implement
``contains``
and
``indexOf``
etc!
f

Florian

07/08/2019, 5:20 PM
What are you referring to exactly
k

karelpeeters

07/08/2019, 5:20 PM
Ah, but the range simply does a check where as the progression needs to loop through all the numbers to see if one matches
2 Views