Created
November 5, 2017 12:23
-
-
Save suhanlee/b5d1c3c15f3480a6021b9ab62d30c5df to your computer and use it in GitHub Desktop.
elixir recursive pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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