# take function

The first elements of a list.

## How to write it

### take(list, n)

**list**

The list. Takes a list.

**n**

How many elements. Takes a whole number.

## Examples

- $\displaystyle \operatorname{take}(\left[ 1, 2, 3, 4 \right], 2) = \left[ 1, 2 \right]$

  `take([1, 2, 3, 4], 2)`

  In the solver, `take([1, 2, 3, 4], 2)` gives `[1, 2]`.

  [Open in the solver](https://hilberon.com/?q=take%28%5B1%2C%202%2C%203%2C%204%5D%2C%202%29)

## Related functions

- [tally](https://hilberon.com/library/tally)

  How often each element occurs: a list of element and count pairs.
- [table](https://hilberon.com/library/table)

  Build a list by evaluating an expression over one or more ranges.
- [thread](https://hilberon.com/library/thread)

  Apply a function to corresponding elements of lists.
- [subsets](https://hilberon.com/library/subsets)

  All the sublists of a list that keep its order, as a list.
- [total](https://hilberon.com/library/total)

  Sum of the elements of a list.
- [sort](https://hilberon.com/library/sort)

  A list in increasing order.

---
Source: https://hilberon.com/library/take
