> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/sass/list/list.to.md).

# list.to()

The `list.to()` function returns [`$list`](#usdlist)  with elements from the first index to the given [`$to`](#usdto) index.

{% code lineNumbers="true" %}

```scss
// Functions.
@use 'list.nth.function';

// Modules.
@use '../number';

// The `list.to()` function.
@function to($list, $to) {
  @return list.nth($list, number.range(0, $to) or $to...);
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/sass/blob/main/list/_list.to.function.scss>" %}

### Parameters

#### **`$list`**&#x20;

The list to get the elements from `1` to given [`$to`](#usdto).

#### `$to`

Index of the last element to retrieve from [`$list`](#usdlist).

### Return

The return value is the list of the elements from `1` to given [`$to`](#usdto) index.

## Examples

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

$-list: ('a', 'b', c, d, 2, 4, 5, (a: 1));

// Examples.
@debug list.to(('a',), 1); // ("a",)
@debug list.to(('a',), -1); // ("a",)

@debug list.to($-list, 1); // ("a",)
@debug list.to($-list, -1); // ((a: 1),)

@debug list.to($-list, 4); // "a", "b", c, d
@debug list.to($-list, 7); // "a", "b", c, d, 2, 4, 5

@debug list.to('&' '.' 'a' 'b' 'c', 2); // "&" "."

```
