> For the complete documentation index, see [llms.txt](https://assurancetourix.gitbook.io/assurancetourix/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://assurancetourix.gitbook.io/assurancetourix/customc/dshell/commands/utils/list.md).

# List

### <mark style="color:blue;">length</mark> (or <mark style="color:blue;">len</mark>)

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list) | [str](/assurancetourix/customc/dshell/types.md#str-string))

</details>

Return the length of the value.

For a [list](/assurancetourix/customc/dshell/types.md#list-list), return the numboer of value inside

For a [string](/assurancetourix/customc/dshell/types.md#str-string), return the number of caracter

### <mark style="color:blue;">add</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list
* <mark style="color:purple;">elements</mark> (any) : values added to the list. Can be any type

</details>

Add all elements in the list passed in the `value` argument.

```
var i []
add i 1 2 3 4 5 6 7 8 9

sm i     :: send <LIST> - [1, 2, 3, 4, 5, 6, 7, 8, 9]
```

### <mark style="color:blue;">remove</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list
* <mark style="color:red;">element</mark> (any) : the element to remove (must be the same !) Can be any type
* <mark style="color:green;">count</mark> ([int](/assurancetourix/customc/dshell/types.md#int-interger)) : the number of element to remove. Default 1

</details>

Remove one or few element in the current list.

```
var i [1,2,3,3,3,4]
remove i 3 --count 2

sm i   :: send <LIST> - [1,2,3,4]
```

### <mark style="color:blue;">clear</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list

</details>

Clear the current list.

It's the same as `var i []`

```
var i [1,2,3]

clear i
:: the following command do the same thing :
:: var i []

sm i   :: send <LIST> - []
```

### <mark style="color:blue;">pop</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list
* <mark style="color:green;">index</mark> ([int](/assurancetourix/customc/dshell/types.md#int-interger)) : The current index to get and remove from the list. Default the last index

</details>

Return and remove one value in the list

```
var i ["a", "b", "c", "d"]

pop i 2

sm __ret__   :: send "c"
sm i         :: send <LIST> - ["a", "b", "d"]
```

### <mark style="color:blue;">sort</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list
* <mark style="color:green;">reverse</mark> ([bool](/assurancetourix/customc/dshell/types.md#bool-boolean)) : Reverse the list after he was sorted

</details>

Sort the current list

```
var i [4,7,1,6,3,9]

sort i

sm i   :: send <LIST> - [1, 3, 4, 6, 7, 9]
```

### <mark style="color:blue;">reverse</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list

</details>

Reverse the current list

```
var i [1,2,3,4,5,6]

reverse i

sm i   :: send <LIST> - [6,5,4,3,2,1]
```

### <mark style="color:blue;">get</mark>

<details>

<summary><strong>Parameters</strong></summary>

* <mark style="color:red;">value</mark> ([list](/assurancetourix/customc/dshell/types.md#list-list)) : targeted list
* <mark style="color:green;">index</mark> ([int](/assurancetourix/customc/dshell/types.md#int-interger)) : the current index to return the corresponding value. Default `0`

</details>

Return the value corresponding to the index in the list

```
var i ["a", "b", "c", "d"]

get i 3

sm __ret__   :: send "d"
sm i         :: send <LIST> - ["a", "b", "c", "d"]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://assurancetourix.gitbook.io/assurancetourix/customc/dshell/commands/utils/list.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
