Skip to content

Instantly share code, notes, and snippets.

@DavidStrada
Created December 26, 2015 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidStrada/92624ccc32eedabc812c to your computer and use it in GitHub Desktop.
Save DavidStrada/92624ccc32eedabc812c to your computer and use it in GitHub Desktop.
Elixir - Recursive List ( for ? or foreach ).
defmodule Loop do
def printer([]) do
[]
end
def printer(list) do
# len = length list
# IO.puts list?
# if length(list) > 0 do
IO.puts hd(list)
Loop.printer( tl(list) )
# Loop.printer(val)
# end
end
end
Loop.printer([1,2,3,10,40,50,100])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment