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
$fromThe value of the number type indicates the beginning of the range.
$to
$toThe value of number type indicates the end of the range.
$step: 1
$step: 1The value of number type indicates each increment of the range. By default, it's 1.
$except: null
$except: null The value of a number or list of numbers not belonging to the range.
$separator: auto
$separator: autoA 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?