RosettaCodeData/Task/Associative-array-Iteration/Elena/associative-array-iteration-2.elena

19 lines
383 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
import system'collections;
import system'routines;
import extensions;
2013-04-10 16:57:12 -07:00
2019-09-12 10:33:56 -07:00
public program()
{
2013-04-10 16:57:12 -07:00
// 1. Create
2019-09-12 10:33:56 -07:00
auto map := new Map<string,string>();
map["key"] := "foox";
map["key"] := "foo";
map["key2"]:= "foo2";
map["key3"]:= "foo3";
map["key4"]:= "foo4";
2013-04-10 16:57:12 -07:00
2013-10-27 22:24:23 +00:00
// Enumerate
2019-09-12 10:33:56 -07:00
map.forEach:
(tuple){ console.printLine(tuple.Item1," : ",tuple.Item2) }
}