I'm new to Elixir and I do not understand the return of the function.
list = %{"100" => 1, "50" => 2, "20" => 4, "10" => 8, "5" => 16, "1" => 32}
for {key, value} <- list, do: String.to_integer(key) * value
Or
Enum.map(list, fn({key, value}) -> String.to_integer(key) * value end)
Returns
' PdPPd'
But when I convert to String
for {key, value} <- list, do: "#{String.to_integer(key) * value}"
Returns
["32", "80", "100", "80", "80", "100"]