---
title: "sortInts"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737268/sortInts"
format: markdown
---
# Description

Sort a list of integers numbers stored in an array.

## Functional area

System

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `sortInts intArray [-d]` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `intArray` | integer array | yes | The array to sort |

### Flags

> Macro (scroll-tablelayout)

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `d` | 0 | — | — | Sorts in descending order. Default is to sort in ascending order. |

## Return value

integer array

Returns the sorted array. 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Demonstrate a simple sort.
int $array[3];
$array[0] = 3;
$array[1] = -1;
$array[2] = 10;
int $sortedArray[] = `sortInts $array`;
print $sortedArray;
```

# Additional information

## Related commands

- [sortFloats](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737671)
- [sortStrings](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736511)