# difference {#difference}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`difference(X)`

## Arguments {#arguments}

**X** is a scalar/vector.

## Details {#details}

Return the last element minus the first element of a vector. If *X* is a scalar, it returns 0.

## Examples {#examples}

```
difference(2 4 2);
// output: 0

difference(12.3 15.6 17.8);
// output: 5.5

difference(278);
// output: 0
```

