Enumerations: Difference between revisions

({{omit from|ZX Spectrum Basic}})
Line 336:
banana 2
cherry 3</lang>
 
=={{header|Icon}} and {{header|Unicon}}==
Nether Icon nor Unicon has an explicit enumeration type; however, there are several approaches that can be used for this purpose:
 
<lang Icon> fruits := [ "apple", "banana", "cherry", "apple" ] # a list keeps ordered data
fruits := set("apple", "banana", "cherry") # a set keeps unique data
fruits := table() # table keeps an unique data with values
fruits["apple"] := 1
fruits["banana"] := 2
fruits["cherry"] := 3</lang>
 
=={{header|J}}==
Anonymous user