Logo

Programming-Idioms

History of Idiom 13 > diff from v48 to v49

Edit summary for version 49 by programming-idioms.org:
[Elixir] Var names k, x

Version 48

2016-10-18, 21:26:16

Version 49

2016-11-14, 19:01:17

Idiom #13 Iterate over map keys and values

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

Illustration

Idiom #13 Iterate over map keys and values

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

Illustration
Extra Keywords
table dictionary hash traverse traversal
Extra Keywords
table dictionary hash traverse traversal
Code
Enum.each(mymap, fn({key, value}) ->
  IO.puts("#{key} => #{value}")
end)
Code
Enum.each(mymap, fn({k, k}) ->
  IO.puts("#{k} => #{v}")
end)
Doc URL
http://elixir-lang.org/docs/v1.0/elixir/Enum.html#each/2
Doc URL
http://elixir-lang.org/docs/v1.0/elixir/Enum.html#each/2
Demo URL
http://play.elixirbyexample.com/s/ed1f67705b
Demo URL
http://play.elixirbyexample.com/s/c64ac488c1