We have an array/list of posts.
posts = ["Elixir is cool", "Making sense of Ember Data", "Gulp is awesome"]
Our objective is to output each post to console.
We can use
Enum.each like this:
Enum.each posts, fn post -> IO.inspect post end
Recursion & Pattern Matching
We can also use recursion and pattern matching.
def output_post([post|posts]) do IO.inspect post output_post(posts) end def output_post(), do: nil