blob: e60e8e5fc5957fb68f991e6c0a2730e8c68164da [file] [log] [blame] [view] [edit]
An array is a collection of objects of the same type `T`, stored in contiguous
memory. Arrays are created using brackets `[]`, and their size, which is known
at compile time, is part of their type signature `[T, ..size]`.
Slices are similar to arrays, but their size is not known at compile time.
Instead, a slice is two-word object, the first word is a pointer to the data,
and the second word is the length of the slice. Slices can be used to borrow a
section of an array, and have `&[T]` as type signature.
{array.play}