List ( [ ] )
An ordered, immutable collection of values.
Syntax
l = [1, 2]; Enum.at(l, 0); length(l); l ++ [x]
Description
Lists are created with square brackets. Enum.at(l, 0) gives the first element (0-indexed), length gives the count. ++ returns a new list (immutable).
Example
Loading editor…
Expected output
[1, 2, 3] 1 3
When to use?
Data collections; processing with Enum.