by unvs · 10y ago · 0 comments
for {item, counter} <- Enum.with_index([:a, :b, :c]) do
IO.puts("#{counter} -> #{item}")
end
0 -> a
1 -> b
2 -> c [:a, :b, :c]
|> Enum.with_index
|> Enum.each(fn({item, counter}) -> IO.puts("#{counter} -> #{item}") end)(Yes, not what the parent poster asked but I still found it useful.)