Note: information on this page refers to Ceylon 1.1, not to the current release.

Iterable enumeration

Iterable enumeration is a notation for creating instances of Iterable.


An example iterable enumeration using listed arguments:

{Integer|Float|String+} tuple = {1, 2.0, "three"};



Syntactically an iterable enumeration is a positional argument list enclosed within braces { and }.

Iterable enumerations are commonly used with comprehensions to create a new Iterable thats filters, combines and/or transforms some other iterables. For example:

value evens = {for (i in 0..100) if (i % 2 == 0) i};

The empty iteratable, {}, has the value empty and the type Empty


the type of an iterable enumeration is simply the Iterable type of the union of the types of the elements in the expression.

See also