Skip to content

Instantly share code, notes, and snippets.

@suhanlee
Created November 5, 2017 12:23
Show Gist options
  • Save suhanlee/b5d1c3c15f3480a6021b9ab62d30c5df to your computer and use it in GitHub Desktop.
Save suhanlee/b5d1c3c15f3480a6021b9ab62d30c5df to your computer and use it in GitHub Desktop.
elixir recursive pattern
defmodule Recurse do
def loopy([head | tail]) do
IO.puts "Head: #{head} Tail: #{inspect(tail)}"
loopy(tail)
end
def loopy([]), do: IO.puts "Done!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment