Anonymous user
Associative array/Iteration: Difference between revisions
→{{header|Elixir}}: remove deprecated module (Dict, HashDict), and then simplify
(→{{header|Babel}}: Updated to interactive-mode syntax) |
(→{{header|Elixir}}: remove deprecated module (Dict, HashDict), and then simplify) |
||
Line 725:
=={{header|Elixir}}==
<lang elixir>
Enum.each(Map.values(d), fn value -> IO.inspect value end)</lang>
▲ Enum.each(d, fn {k,v} -> IO.puts "#{k}: #{v}" end)
▲ Enum.each(Dict.keys(d), fn key -> IO.inspect key end)
▲ Enum.each(Dict.values(d), fn value -> IO.inspect value end)
{{out}}
<pre>
%{bar: 2, baz: 3, foo: 1}
{:baz, 3}
bar: 2▼
:baz => 3
:bar
:baz
:foo
2
3
1
▲foo: 1
</pre>
|