# last {#last}

## Syntax {#syntax}

`last(X)` / `last X`

## Arguments {#arguments}

**X** is a scalar/vector/matrix/table.

## Details {#details}

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

If the last element is null, the function returns NULL. To get the last non-null element, use [lastNot](lastNot.md).

## Examples {#examples}

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

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

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

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

```
last(m);
// output: [3,6]
```

Related function: [first](../f/first.md)

