# set {#set}

## Syntax {#syntax}

`set(X)`

## Arguments {#arguments}

**X** is a vector

## Details {#details}

Return the corresponding set object of vector *X* .

## Examples {#examples}

Function `set` returns a set.

```
x=set(4 5 5 2 3 11 6);
x;
// output: set(6,11,3,2,5,4)

x.intersection(set([2,5,9]));
// output: set(2,5)
```

In comparison, function [distinct](../d/distinct.md) returns a vector.

```
distinct(4 5 5 2 3 11 6);
// output: [6,11,3,2,5,4]
```

Use function keys to convert sets to vectors:

``` {#codeblock_opb_kgh_nzb}
x=set(4 5 5 2 3 11 6);
x.keys()
// output: [6,11,3,2,5,4]
```

