Collection
Adds, retrieves, and removes values in a collection. A collection is a store for many values and comes in two types, list and map. The collection type and its key and value types are set when the collection is created in Settings > Collection (Part 6).
- List: Stores values in order. Each value has an index (position number) starting from 0, and values are found, added, changed, and removed by index.
- Map: Stores values as key-value pairs. The key is a unique identifier, and values are found, added, changed, and removed by key.
An example list (a shopping list) looks like this.
| Index | Value |
|---|---|
| 0 | Apple |
| 1 | Milk |
| 2 | Meat |
| 3 | Ramen |
An example map (a phone book) looks like this.
| Key | Value |
|---|---|
| John Smith | 010-1111-2222 |
| Emily Johnson | 010-2222-3333 |
| Michael Brown | 010-3333-4444 |
Collection
Select the collection to use. The list commands or the map commands below are shown according to the type of the selected collection, and the value and key fields take the input format of the value type and key type set for the collection.
List commands
| Command | Description | Input fields | Output variables |
|---|---|---|---|
| Push Front | Adds a value at the first position (index 0). | Value | |
| Push Back | Adds a value at the end of the list. | Value | |
| Insert At | Adds a value at the given position. | Position, Value | |
| Resize | Changes the size of the list. A collection with a maximum size cannot exceed it. | List Size | |
| Remove Front | Removes the first value. | ||
| Remove Back | Removes the last value. | ||
| Remove At | Removes the value at the given position. | Position | |
| Clear All | Removes all values. | ||
| Get Front | Reads the first value. | Value | |
| Get Back | Reads the last value. | Value | |
| Get At | Reads the value at the given position. | Position | Value |
| Find | Finds a value and returns its position. Returns -1 if the value is not found. | Value | Value Position (number) |
| Set At | Changes the value at the given position. | Position, Value | |
| Size | Reads the number of values in the list. | List Size (number) | |
| Is Empty | Returns true if the list is empty. | Is Empty List (digital) | |
| Sort Ascending | Sorts the values in ascending order. | ||
| Sort Descending | Sorts the values in descending order. | ||
| Reverse | Reverses the current order. |
Position is a 0-based index (0 to 4294967295), and the default of the List Size input is 10. The Value input and the Value output variable follow the value type of the collection.
Map commands
| Command | Description | Input fields | Output variables |
|---|---|---|---|
| Add | Adds a key-value pair. | Key, Value | |
| Set | Changes the value associated with the key. | Key, Value | |
| Remove | Removes the key-value pair. | Key | |
| Get Value | Reads the value associated with the key. | Key | Value |
| Find | Checks whether the key exists. | Key | Key Exists (digital) |
| Clear All | Removes all key-value pairs. | ||
| Size | Reads the number of pairs in the map. | Map Size (number) | |
| Is Empty | Returns true if the map is empty. | Is Empty Map (digital) |
The Key input follows the key type of the collection, and the Value input and output variable follow its value type.