Function range

  • Returns an iterable representing a sequence of numbers, from start to stop.

    This function can be called in three different ways:

    1. Passing only a stop variable counts from zero until stop, in increments of 1.
    2. Passing a start and stop counts from start until stop, in increments of 1.
    3. Passing a start, stop, and step counts from start until stop in increments of step. step can be positive or negative.

    Parameters

    • stop: number

    Returns It<number>

    Example

    // Returns an Iterable representing [0, 1, 2]
    it.range(3)

    Example

    // Returns an Iterable representing []
    it.range(-10)

    Example

    // Returns an Iterable representing [3, 4, 5, 6]
    it.range(3, 7)

    Example

    // Returns an Iterable representing [2, 4, 6]
    it.range(2, 8, 2)

    Example

    // Returns an Iterable representing [5, 4, 3, 2, 1, 0, -1]
    it.range(5, -2, -1)