BaseIntFromUntilRepeatingIterator

constructor(from: Int, toExclusive: Int, offset: Int = 0, step: Int = 1)(source)

Parameters

from

The inclusive lower bound of the range (in case offset = 0 also the starting number) -- has to be less than toExclusive.

toExclusive

The non-inclusive upper bound of the range. Put differently. the number which is no longer included in the range, i.e. if the current number + step is greater than toExclusive then the next number is from again -- has to be greater than from.

offset

Influences from which number the range starts where it defines an offset to the from of the range in terms of steps, taking toExclusive and the infinite character of this iterator into account. Following a few examples:

  • startIndex=1, endIndexExclusive=4, step=1, offset=1 => range starts at 2

  • startIndex=1, endIndexExclusive=4, step=2, offset=1 => range starts at 3

  • startIndex=1, endIndexExclusive=4, step=2, offset=2 => range starts at 1 (since 5 is already greater than 4 it starts over at 1)

  • startIndex=1, endIndexExclusive=4, step=2, offset=3 => range starts at 3

step

Defines the step from the current number to the next - must be greater than 0.