Lists
Calibre uses list:<T> for ordered collections.
let numbers : list:<int> = list:<int>[1, 2, 3];// The type list:<str> will be inferred from the values in the listlet words := ["alpha", "beta", "gamma"];If the type is clear from context, you can also write an empty list with [].
let mut values : list:<int> = [];Lists can be indexed with [].
let numbers := [10, 20, 30];
print(numbers[0]);print(numbers[1]);The standard library provides many useful list methods.
let mut numbers := list:<int>[1, 2, 3];numbers.push(4);
print(numbers.len());print(numbers.contains(2));print(numbers.pop());Lists are one of the most common collection types in Calibre, and you will see them often in loops, comprehensions, and iterators.