math.range()

The math.range() function returns the range of numbers.

// Sass.
@use 'sass:list';

// Functions.
@use '../meta/meta.of-type.function';

// Modules.
@use 'range';

// The `math.range()` function.
@function range($from, $to, $step: 1, $except: null, $separator: auto) {
  @return if(
    meta.of-type(number, $from, $to, $step),
    if(
      $from < $to,
      range.up($from, $to, $step, $except, $separator),
      range.down($from, $to, $step, $except, $separator)
    ),
    null
  );
}
https://github.com/angular-package/sass/blob/main/math/_math.range.function.scss

Parameters

$from

The value of the number type indicates the beginning of the range.

$to

The value of number type indicates the end of the range.

$step: 1

The value of number type indicates each increment of the range. By default, it's 1.

$except: null

The value of a number or list of numbers not belonging to the range.

$separator: auto

A separator between the given range numbers.

Return

The return value is the list of numbers from the given range.

Examples

Last updated

Was this helpful?