list.last()

The list.last() function returns the last element of $list.

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

// The `list.last()` function.
@function last($list) {
  @return list.nth($list, list.length($list));
}
https://github.com/angular-package/sass/blob/main/list/_list.last.function.scss
// Sass.
@use 'sass:list';

// Status: DONE
// The `list.last()` function returns the last element of `$list`.
// @param `$list` The list to get the last element from.
// @return The return value is the last element of `$list`.
@function last($list) {
  @return list.nth($list, list.length($list));
}

// Examples.
// @debug last(('a', 'b', c, d, 2, 4, 5, (a: 1))); // (a: 1)

Parameters

$list

The list to get the last element from.

Return

The return value is the last element of $list.

Examples

// Use.
@use 'angular-package/sass/list';

// Examples.
@debug list.last(('a', 'b', c, d, 2, 4, 5, (a: 1))); // (a: 1)

Last updated

Was this helpful?