> For the complete documentation index, see [llms.txt](https://docs.thunkable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thunkable.com/~/changes/wHhkjLVeheBnfbpghRnw/lists.md).

# Lists

## Create a List

You can create a list of variable lengths with the blocks below

### Empty List

Creates an empty list

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FRDV4tqdwf1U4GkWfwoCm%2Flist-emp.png?alt=media\&token=744941bc-db10-4c69-a284-36b7476e2a8c)

### List of Specific Items

Allows you to specify what items in what order you want in your list

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FL0UcR7PlEGNbovBLtb32%2Flist-preset.png?alt=media\&token=ae8c43c7-6840-4b96-b507-50e1cbf06662)

### List of item repeated X Times

Creates a list of a given item repeated a specified number of times.

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FwZY4eZgEIF2LpbO40qTj%2Flist-repeat.png?alt=media\&token=80d6a0ad-af8a-4b32-8c3b-6000e3f21130)

### List of numbers from X to Y

Create a list between two numbers, with a chosen increment.

Eg. list of 1 to 5 by 1 is `[1, 2, 3, 4, 5]`. List of 2 to 10 by 2 is `[2, 4, 6, 8, 10]`

![](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\&token=ccc0640e-08a9-49da-bea0-d3065ead1ac2)

### Make List from Text

This block lets you create a list from text and even lets you set delimiters i.e. ","

You can also use this block to make text from a list with a given delimiter

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FuaEuVjSSTotY2tFBUToq%2Flist-delim.png?alt=media\&token=d4461fff-6628-4da1-87c6-d91a0585a29a)

## Sort List

If you are importing a list from a Spreadsheet or other data source, it may be helpful to sort it in your app. You can sort a list alphabetically or numerically, ascending or descending

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FxbRcNygPuYRazL7xtUGh%2Flist-sort.png?alt=media\&token=298a7920-002f-4f36-bf6d-4499ed1dae91)

![](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\&token=c5f62626-4cba-40f4-b708-73ff065a7534)

![](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\&token=e3ef850d-1c54-4950-8f0c-1079abdd379a)

## Analyze List

The following blocks analyze a list in different ways

### Length of List

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fc8JrZKvRvsWn0aT1F5zm%2Flist-len.png?alt=media\&token=fa352ebd-5b3e-48e5-9f23-afdbeb470e62)

Returns the length of a list as a number.

### Is List Empty

![](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\&token=cd77c5b8-9957-4f1a-a509-db5e3d4c38fd)

Checks if a list is empty. Returns **true** or **false**.

### Find First/Last Occurrence

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FRZ2zKwEIyz0RxaHIiYSc%2Flist-find.png?alt=media\&token=b58d5f20-7685-45d7-b89f-7abba2e2facb)

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

### Does List contain Item

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FmMudhQzCDyvQOG2v1CWm%2Flist-contain.png?alt=media\&token=c4c5202e-3272-4e7b-8869-b7052f0bd0a7)

Checks if a given list contains a given item. Returns **true** or **false**.

### Sum, Min, Max, Averages, Standard Deviation, Random Item

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FpTb95kvduVTsA05GqJ1S%2Flist-ops.png?alt=media\&token=f27ad657-0eef-4e3f-b404-5339710744f2)

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.

## Select from a List

### Get

Items in a list have an index number. \
The first item is 1, second is 2 and so on. \
You can get:

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

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FdkrpZdWPB1a3tdCaONuX%2Flist-get.png?alt=media\&token=fe6ded6e-663b-4c8e-a999-5f66de83f3f4)

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FJb5ygYDQzThNDRDpfpeo%2Flist-getnum.png?alt=media\&token=6910028d-8ae9-448c-8099-ad658fe4f669)

### Get and Remove

Behaves the same as the Get block, except the chosen item is removed from the list.

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FS2VPBhqgek5p3EzZxiF0%2Flist-getandremove.png?alt=media\&token=bb27bed2-f38f-4dd1-8ef3-3f13aa69d311)

### Random item

Returns random item of list.

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2F48f7lmy18p8GPiO9oQjP%2Flist-ran.png?alt=media\&token=d8b6f309-c7ee-4a8f-98d6-7d18d9de27bf)

### Get Sub-list

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FpjTzN5vccSo9e6ktl0nY%2Flist-sub.png?alt=media\&token=d7dfd575-42f0-4ba2-b352-be4b01bee2f0)

Returns a sub-list of items between two positions in a longer list.

### Get Shuffled List

Get a copy of a list with the items shuffled in a random order.

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FqeDFqMfD7Aa8zkr3xAn3%2Flist-shuffle.png?alt=media\&token=fe70ac26-03fb-4295-bbd5-ae4df153c106)

## Modify List

You can change an item in your list with the blocks below

### Insert At/Set

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FNAR0wqeHAoa0F6XA1SPy%2Flist-insert.png?alt=media\&token=70601332-755c-4eb8-8f77-2ec819a383ce)

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FhCPPeZ1NW3e1l2DsRa3L%2Flist-insertlast.png?alt=media\&token=32b6184c-603a-46c1-8e52-21d48a7d0d84)

This block will either **insert** an item at the specified location, or **set** the item at the specified location to the new value.

### Remove Item from List

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FAFJXSSpGKb0WdWvACom6%2Flist-remove.png?alt=media\&token=13296125-930a-43c3-b765-60d4ac8ceb04)

Removes the item at the specified position from a list
