Go to the first, previous, next, last section, table of contents.


Tuples

A tuple is, as somebody once described, an `unencapsulated ordered list of heterogeneous values'. The type of a tuple is the tuple type composed of the types of the elements (see section Tuple types).

tuple:
          `(' tuple_elements `)'
        ;

tuple_elements:
          tuple_element [`,' tuple_elements]*
        ;

tuple_element:
          [expression]
        ;

When used as an rhs expression, each tuple_element of a tuple must not be empty. Empty tuple elements are allowed when the tuple is used as the lhs in an assignment; every empty field indicates a value in the tuple to be ignored. For example, the following expression is an, albeith elaborate, way to assign the value 2 to the variable a.

(,, a,,,) = (0, 1, 2, 3, 4, 5)


Go to the first, previous, next, last section, table of contents.