Associative array/Iteration: Difference between revisions

Content added Content deleted
(Added Elixir)
Line 489: Line 489:
<lang elena>#define system.
<lang elena>#define system.
#define system'collections.
#define system'collections.
#define system'routines.
#define extensions.


// --- Program ---
// --- Program ---
Line 496: Line 498:
// 1. Create
// 1. Create
#var aMap := Dictionary new.
#var aMap := Dictionary new.
aMap set &key:"key" &object:"foox".
aMap@"key" := "foox".
aMap set &key:"key" &object:"foo".
aMap@"key2":= "foo2".
aMap set &key:"key2" &object:"foo2".
aMap@"key3":= "foo3".
aMap set &key:"key3" &object:"foo3".
aMap@"key4":= "foo4".
aMap set &key:"key4" &object:"foo4".


// Enumerate
// Enumerate
control run:aMap &forEach: aKeyValue
aMap run &each: aKeyValue
[ console write:(aKeyValue key) write:" : " writeLine:aKeyValue ].
[ console writeLine:(aKeyValue key):" : ":aKeyValue ].
].</lang>
].</lang>