Logo

Programming-Idioms

History of Idiom 13 > diff from v13 to v14

Edit summary for version 14 by :

Version 13

2015-08-23, 23:52:55

Version 14

2015-09-04, 11:28:55

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

Code
Enum.each(mymap, fn({key, value}) ->
  IO.puts("#{key} => #{value}")
end)

for {key, value} <- mymap, do: IO.puts("#{key} => #{value}")
Doc URL
http://elixir-lang.org/docs/v1.0/elixir/Enum.html#each/2
Demo URL
http://play.elixirbyexample.com/s/b8dac50bca