Lists
A list is an ordered collection of items, such as a "to do" list or a shopping list. Items in a list may be of any type, and the same value may appear more than once in a list.
Contents
Introduction
Lists are very useful when you need to handle multiple items, such as objects, in bulk. Besides that, in a list you can store any kind of information, such as configurable options, properties of similar HTML elements, RGB values, coordinates, etc.
Puzzles Reference
create
This puzzle allows you to create a new list and specify the initial values. Additional inputs are added by dragging an item block from the gray toolbox on the left into the list block.
The following example hides all 3 objects specified in the list once the user clicks on the cube.
Lists can be nested (e.g. list of lists), or have no entries specified at any of the positions. In the latter case a null value is automatically put in a missed position.
length
This puzzle counts the number of items in the specified list. The null values automatically inserted in missed positions will also be counted.
Example:
get / remove
This puzzle retrieves (and / or removes) the item from the specified position (items in a list are indexed starting from 0).
Example:
set / insert
This puzzle allows you to add items to a list. The set variant replaces the item at a specified position in a list with a different item (the length of the list stays the same). The insert variant adds a new item into the list at the specified position, shifting the item previously at that position (thus increasing the length of the list). Remember that items in a list are indexed starting from 0.
Example:
create empty
This puzzle creates a new blank list to be filled with items later.
Example:
create with item repeated
This puzzle creates a new list and initiates all the positions with the same given item. The main difference with the create empty variant is that the list is initialized with a predefined length, and with some initial values.
Example:
reverse
This puzzle creates a new list filled with the items from the original list in reverse order. The original list will not be changed.
Example:
is empty
This puzzle checks if a specified list does not contain any items, and returns true in such the case, or false otherwise. For using with Logic puzzles.
Example:
find
This puzzle can be used to check whether an item is contained in a list and, if so, where it appears. If the item was found, it returns its position (items in list are indexed starting from 0). If the item was not found, the puzzle returns -1.
Example:
check item
This puzzle can be used to check whether an item is contained in a list. If the item was found, it returns boolean value true . If the item was not found, the puzzle returns false.
get sub-list
This puzzle allows a region of list between two specified positions to be extracted as new list (items in list are indexed starting from 0). The original list will not be changed.
Example:
sort
This puzzle creates a new list filled with the items from the original list sorted in ascending or descending order. The original list will not be changed.
Examples:
list from text / text from list
This puzzle allows you to create a list by splitting some text, or do the opposite - join list items into a line of text.
Example for text splitting into list:
Example for list joining into text:
See Also
Lists store elements by numeric index. If you need a storage with named elements, refer to dictionaries.
Having Troubles with Puzzles?
Seek help on the forums!