List: keeping items in order

Syntax and values

A list keeps several values together in a chosen order. It can hold scores, player names, or other items.

let scores = [10, 20, 30]
let empty = []
let mixed = [1, "two", true, none]

Lists preserve order and may contain any value. A trailing comma is accepted.
Indexes are zero-based, non-negative whole numbers:

say scores[0]
set scores[1] = 25

An index must already be in range. Lists have fixed length because there is no
append operation in the current standard library. left + right creates a new
concatenated list.

Example

# language: en
let items = [10, 20]
set items[0] = 15
let more = items + [30]
say items, more

Syntax and values · Built-ins · Programming guides