# Lists Blocks

## Overview

The list blocks allow you to work with lists or arrays of elements. This includes operations like adding or removing items from a list, accessing specific items by their position, and sorting items. List blocks allow you to manipulate and manage data, making it easier to store, organize, and process multiple pieces of information.

## List of Specific Items

This block allows you to define the items you want in your list and the specific order in which you want them arranged. Click the plus icon to add or the minus to remove list items.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FdYSErzlmEdw4Y3aRRo7n%2Flist.jpg?alt=media&#x26;token=51201744-8c51-47ec-a9e9-8dad3aa778f4" alt=""><figcaption></figcaption></figure></div>

## Empty List

This block allows you to create an empty list.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fjh59yIYCUN5XwENYOHNi%2Flisttt.jpg?alt=media&#x26;token=f546ca63-943c-4255-b0c0-8dc905252924" alt=""><figcaption></figcaption></figure></div>

## Mathematical Values and Random Item&#x20;

This block returns a random item or performs mathematical calculations on a list, including sum, minimum, maximum, average, etc. Returns the result of the chosen operation on a list of numbers. Returns "NaN" if the operation cannot be performed on the given list of values.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FKnLgqj8tyX6puf04qub2%2Frandomm%20listt.jpg?alt=media&#x26;token=c273ac6d-53a5-4401-8f82-2039d95db02b" alt="" width="410"><figcaption></figcaption></figure></div>

## Length of List

This block analyzes a list and returns the length of a list as a number.&#x20;

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FaTL7nVScVYs1zvmC7HeX%2Flenght.jpg?alt=media&#x26;token=4ee23ae0-10f3-46c9-ba86-3f5d7da53a33" alt=""><figcaption></figcaption></figure></div>

## Shuffle List

This block generates a copy of a list with the items shuffled in a random order.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FbhJQVZAHmleMDChoP0xG%2Fsuffle.jpg?alt=media&#x26;token=fe7beaef-c989-431b-a6d5-fc023b496953" alt=""><figcaption></figcaption></figure></div>

## Does List Contain

This block checks if a list contains a given item. Returns true or false.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FLW7YHuEm4QbeLb9qSCGv%2Fdoes%20list.jpg?alt=media&#x26;token=4d092d04-49cd-47a2-b5f2-5ec337f9c251" alt=""><figcaption></figcaption></figure></div>

## Find First/Last Occurrence

This block returns the position of the first or last occurrence of an item in a list, where the index of the first item is 1. Returns 0 if the item is not in the list.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FXGAmoAgFj7gLzCIe3u7c%2Fin%20list.jpg?alt=media&#x26;token=242ded56-a22f-4e86-b5b4-dde617252c4a" alt=""><figcaption></figcaption></figure></div>

## Get, Get and Remove, or Remove

Each item in a list has an index number. The first item in a list is 1, the second is 2, etc. This block allows you to get, get and remove, or remove:

* An item at position X
* An item X items from the end of the list
* The first item
* The last item
* A random item

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Ff0yjRJFUFQGA9MeOZ4VL%2Flist%20get.jpg?alt=media&#x26;token=3761d7d3-805a-4233-9c7a-a17dcc453327" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F5Kgz3BLbGAZLWQs8IRWl%2Fin%20list%20get%20number.jpg?alt=media&#x26;token=cead6642-2b06-4006-8d2a-6896803cb2b9" alt=""><figcaption></figcaption></figure></div>

## Insert At or Set

These blocks allows you to modify a list. You can insert an item at the specified location or set the item at the specified location to the new value.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FZMIp0HlDeS8t2rJFM3Xr%2Fin%20list%20insert.jpg?alt=media&#x26;token=e6fc868e-689b-44c1-9211-0b65452c37cf" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fm5ino49EYrCSTAIBKzrp%2Fin%20list%20insert2.jpg?alt=media&#x26;token=f1f6ac48-0746-4020-bed7-dc0259c644da" alt=""><figcaption></figcaption></figure></div>

## Sort List

This block allows you to sort a list alphabetically or numerically, ascending or descending. This can be especially helpful if you import a list from a data source.&#x20;

&#x20;

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F5s1DWwBIeZK3JnTOZsRT%2FScreenshot%202025-03-14%20154409.jpg?alt=media&#x26;token=4a62debf-24b5-4442-9ee5-020d67ec1db5" alt="" width="395"><figcaption></figcaption></figure></div>

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FhYYhMAtRazahmbb6cF2U%2Flist-num-asc.png?alt=media&#x26;token=c5f62626-4cba-40f4-b708-73ff065a7534" alt=""></div>

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FR7KNX3ic9EeAWsyoAcow%2Flist-num-desc.png?alt=media&#x26;token=e3ef850d-1c54-4950-8f0c-1079abdd379a" alt=""></div>

## Get Sub-list

This block returns a sub-list of items between two positions in a longer list.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F9xHocQLrE3HrKu8ttDqd%2FScreenshot%202025-03-14%20154609.jpg?alt=media&#x26;token=beeaccd1-0c71-4ccb-8209-1c49c50bb5c0" alt="" width="563"><figcaption></figcaption></figure></div>

## Concant list

This block returns a list that is a concatenation of the two lists.

<figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FFv3m5QNuqIJTFJSLgkqW%2Fconcant%20list.png?alt=media&#x26;token=123f20bc-30b6-4bd2-803e-7fca325b9c6b" alt=""><figcaption></figcaption></figure>

## List of Numbers from \[X] to \[Y] by \[Z]

This block creates a list between two numbers with a defined increment. For example:

* A list of numbers from 1 to 5 by 1 is `[1, 2, 3, 4, 5]`.&#x20;
* A list of numbers from 2 to 10 by 2 is `[2, 4, 6, 8, 10]`.&#x20;

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FreO2pTpz3w5NsvVvauDl%2Flist-nums.png?alt=media&#x26;token=ccc0640e-08a9-49da-bea0-d3065ead1ac2" alt="" width="375"></div>

## Create List with Item Repeated \[X] Times

This block creates a list of a given item repeated a specified number of times.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FHhGYtOtwKUrSBUo7n2o8%2Flist%20blocks%20-%20create%20list%20repeated.png?alt=media&#x26;token=15f10550-0e1a-4bff-9135-62ce7b5b4117" alt="" width="375"><figcaption></figcaption></figure></div>

## Make List from Text or Make Text from List

This block allows you to create a list from text or a text from a list and define the delimiter (e.g. ",").&#x20;

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F4dBf6cyCGxWVnQ7D5oil%2Flist%20blocks%20-%20make%20list%20from%20text.png?alt=media&#x26;token=163d8395-427b-43c3-b38f-26c6276192d8" alt="" width="375"><figcaption></figcaption></figure></div>

## Is Empty

This block checks whether or not a list is empty and returns true or false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FzWp0tDzKtgA6gxxlYQrm%2Flist-isemp.png?alt=media&#x26;token=cd77c5b8-9957-4f1a-a509-db5e3d4c38fd" alt="" width="188"></div>

## Filter list or Map list

The "filter list" block generates a copy of a list with the items that make the condition true.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FMtvZ9GKpJKZp9KeioEX4%2Ffilter%20map.png?alt=media&#x26;token=4bdd26b8-0076-4c78-8250-88a85b442919" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FIlBwW5X6mpdhr8Q8IGAE%2Ffilter%20block.png?alt=media&#x26;token=3d452baf-2d1d-45d6-b4ec-dc2ae8a751c9" alt=""><figcaption><p>Retuns the list: 1,2,3</p></figcaption></figure></div>

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FWCpXCy3u9L2uOE0DbLCI%2Ffilter%20example.png?alt=media&#x26;token=8182555a-85cb-4687-b11a-455c32b285da" alt=""><figcaption><p>Returns the list: 3</p></figcaption></figure></div>

The "map list" block generates a copy of a list with the items updated based on the return block.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F7imJs9VfPRNOQIkh0TFe%2Fmap%20example.png?alt=media&#x26;token=f259aab8-a785-4399-988f-13e7c02e0617" alt=""><figcaption><p>Retuns the list: 2,3,4</p></figcaption></figure></div>


---

# Agent Instructions: 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:

```
GET https://docs.thunkable.com/blocks/blocks/lists.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
