Array
An Array is a collection of objects which can grow or shrink dynamically.
Alternatively, one can write:
Working with arrays
Elements of an array can be accessed with the special syntax array[i]
where i
is a zero-based index inside the array.
Special arrays
Arrays of strings or numbers can be created with a special syntax:
Unescaped spaces and unescaped comments are removed. For example, the following declaration:
...is equivalent with ["Sidney", "New York"]
.
There is also %W(...)
which understands escapes and interpolation:
...which means: ["hello\tworld", "one item", "3"]
.
Another way is by using the <...>
and «...»
delimiters:
Last updated