# first {#first}

## Syntax {#syntax}

`first(X)`

or

`first X`

## Arguments {#arguments}

**X** can be a scalar, pair, vector, matrix or table.

## Details {#details}

Return the first element of a vector, or the first row of a matrix or table.

If the first element is a null value, the function returns NULL. To get the first non-null element, use [firstNot](firstNot.md).

## Examples {#examples}

```
first(`hello `world);
// output: hello

first(1..10);
// output: 1

m = matrix(1 2 3, 4 5 6);
m;
```

|\#0|\#1|
|---|---|
|1|4|
|2|5|
|3|6|

```
first(m);
// output: [1,4]
```

Related function: [last](../l/last.md)

