# isSorted {#issorted}

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

## Syntax {#syntax}

`isSorted(X, [ascending=true])`

## Arguments {#arguments}

**X** is a vector.

**ascending** is a Boolean indicating whether *X* is sorted in ascending order\(true\) or descending order\(false\). The default value is true.

## Details {#details}

Check whether a vector is sorted or not.

## Examples {#examples}

```
x=NULL 1 2 3
isSorted(x);
// output: true

t=table(9 7 5 3 as x, 1 5 2 4 as y)
t.x.isSorted(false);
// output: true

t.y.isSorted();
// output: false
```

