Logo

Programming-Idioms

History of Idiom 13 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-20, 14:29:20

Version 8

2015-08-20, 14:29:36

Idiom #13 Iterate over map keys and values

Print each key k i with its value x from an associative array mymap

Idiom #13 Iterate over map keys and values

Print each key k i with its value x from an associative array mymap

Imports
std.stdio;
Imports
import std.stdio;
Code
int[string] aa;
foreach (string k; aa.byKey)
    writeln("Key: ", k, " Value: ", aa[k]);
Code
int[string] aa;
foreach (string k; aa.byKey)
    writeln("Key: ", k, " Value: ", aa[k]);
Comments bubble
D has build-in associative array
Comments bubble
D has build-in associative array