Associative array/Iteration: Difference between revisions
Content deleted Content added
Prolog |
Added zkl |
||
Line 1,976:
B beta
C gamma
</pre>
=={{header|zkl}}==
<lang zkl>var d=D("A","alpha","D","delta", "B","beta", "C", "gamma");
d.keys.pump(Console.print,fcn(k){String(k,",")})
d.values.apply("toUpper").println();
d.makeReadOnly(); // can only iterate over k,v pairs if read only
foreach k,v in (d){print(k,":",v,"; ")}</lang>
{{out}}
<pre>
A,B,C,D,
L("ALPHA","BETA","GAMMA","DELTA")
A:alpha; B:beta; C:gamma; D:delta;
</pre>
|