Closely related to scalars are arrays and tuples. These types are ordered collections of scalar values that are treated as a single value themselves.
Arrays are homogeneous collections, meaning that all of the elements have to be of the same type:
Array elements can be accessed by giving an index (starting
with 0) enclosed in [...]
:
Tuples are heterogeneous collections, meaning that tuple elements can be of any type (that includes arrays and tuples as well):
Tuples elements can be accessed by specifying an index after a .
:
Tuples can also give names to their elements. In that case the tuple elements can be accessed by either name or index: