Associative array/Iteration: Difference between revisions

Content added Content deleted
mNo edit summary
Line 726: Line 726:


=={{header|Elena}}==
=={{header|Elena}}==
<lang elena>#define system.
<lang elena>#import system'collections.
#define system'collections.
#import system'routines.
#import extensions.
#define system'routines.
#define extensions.


program =
// --- Program ---

#symbol program =
[
[
// 1. Create
// 1. Create
#var aMap := Dictionary new.
var aMap := Dictionary new.
aMap@"key" := "foox".
aMap@"key" := "foox".
aMap@"key" := "foo".
aMap@"key2":= "foo2".
aMap@"key2":= "foo2".
aMap@"key3":= "foo3".
aMap@"key3":= "foo3".
aMap@"key4":= "foo4".
aMap@"key4":= "foo4".


// Enumerate
// 2. Enumerate
aMap run &each: aKeyValue
aMap run &each: aKeyValue
[ console writeLine:(aKeyValue key):" : ":aKeyValue ].
[ console writeLine:(aKeyValue key):" : ":aKeyValue ].