joyofelixir
joyofelixir copied to clipboard
Chapter 14: List recursion in a function
We should show an example of doing list recursion in a function here, because it is hinted at in Chapter 6.
defmodule People do
def list_names([]), do: :ok
def list_names([%{"name" => name} | names]) do
IO.puts name
list_names(names)
end
end