Note: information on this page refers to Ceylon 1.2, not to the current release.
Tuple enumeration
Tuple enumeration is a notation for creating instances of
Tuple
.
Usage
An example tuple enumeration using listed arguments:
[Integer, Float, String] one23 = [1, 2.0, "three"];
Description
Syntax
Syntactically a tuple enumeration is a
positional argument list enclosed
within square brackets [
and ]
.
If you supply no arguments you obtain the empty tuple, []
,
which is precisely the same as
empty
.
All kinds of positional argument are available. For example, consider the tuple constructed using a spread argument:
[Integer, Integer, Float, String] zero123 = [0, *one23];
Or a tuple enumeration with a comprehension argument:
value oneTo10
= [1, 2, for (i in 3..10) i ];
Type
The type of a tuple enumeration is the
Tuple
type of the list of arguments it contains.
See also
- Iterable and tuple enumeration in the Ceylon language specification