A heterogeneous list of Any
The complete source of builtInTypes_any_list.ek9, compiled by the EK9 compiler. Shown on builtInTypes.html.
#!ek9 defines module site.builtintypes.anylist defines type CardSuit Hearts Diamonds Clubs Spades defines program AnyList() stdout <- Stdout() //A heterogeneous list - declare List of Any (an undeclared mix sharing only Any is E50030) mixedList as List of Any: [ 1, "hello", 2024-01-15, CardSuit.Hearts ] //To process these, use a dispatcher - see Advanced Class Methods stdout.println(length of mixedList)
Download builtInTypes_any_list.ek9
Output
4