yta
    Preparing search index...

    Function range

    • Generate a sequence of numbers between start and stop (start inclusive; stop non-inclusive). If stop is not specified generate start many number starting at 0. If start is not specified generate an infinitly long sequences starting at 0.

      import { pipe } from "yta";
      import { range, take, toArray } from "yta/sync";

      pipe(range(), take(5), toArray());
      // => [0, 1, 2, 3, 4]

      [...range(5)];
      // => [0, 1, 2, 3, 4]

      [...range(10, 13)];
      // => [10, 11, 12]

      [...range(42, 50, 3)];
      // => [42, 45, 48]

      [...range(15, 10, -1)];
      // => [15, 14, 13, 12, 11]

      Parameters

      • Optionalstart: number

        The starting number (inclusive) or sequence length if stop is not specified

      • Optionalstop: number

        The stopping number (non-inclusive)

      • Optionalstep: number = 1

        The step increment.

      Returns Generator<number, void, any>