Skip to main content

Lists

Create List

Block lists_create_with

This block creates a list with all the items you give it. Here is an example that creates a list with two items, namely 0.5 and 1:

create list example

This type of list can, for example, be used to set the position of a clip (where the first item is used as x and the second item as y value).

If you click on the blue cogwheel icon, you can change the number of list elements (and even reorder them):

If you remove all entries, you can also create an empty list:

create empty list example

List Repeat

Block lists_repeat

This creates a list with many identical values. These two blocks do exactly the same thing:

repeat list example

Length of List

Block lists_length

This block returns the length of the list (i.e. the number of items contained in the list).

Is Empty List

Block lists_isEmpty

This block returns the Logic value true if the given list is empty and false otherwise. The following two are identical:

list empty example

Find in List

Block lists_indexOf

This block searches though the items in the given list and when it finds one that has the given value, it returns the (one-based) index of that element. If none of the elements has the given value, it returns 0.

find in list example

This example searches in the list 0,200,50 for the value 50. Since 50 is the third element in the list, the result is 3. If you searched for 60 instead, the result would be 0 (since 60 is not in the list at all).

Get in List

Block lists_getIndex

This returns and/or removes the item from the list. If you choose #, you need to give the index of the item you want to retrieve, so 1 for the first list item, for example.

Set in List

Block lists_setIndex

This block can set (i.e. overwrite) an item in the list or insert a new one. Note that indices are 1-based, so #3 is the third element of the list.

Get Sub-list

Block lists_getSublist

Returns a smaller list containing only a subset of the items of the given list.

List From/To Text

Block lists_split

If you have a text that consists of several values separated by a comma (or other delimiter symbol), this block can turn the text into an actual list. These two blocks have exactly the same result:

split list example

Note that the conversion does not remove any empty space symbols around the delimiter. Therefore, if your list elements are separated by a comma and a space, i.e. item1, item2, item3,... instead of item1,item2,item3,... then you should use , (a comma and a space) as separator because otherwise the list entries will have a space at the beginning. Of course, you can also remove whitespace with the Trim Spaces block.

Sort List

Block lists_sort

This block can sort the items in a list. Numeric is useful for lists of numbers and alphabetic for lists of texts.