Skip to content

Instantly share code, notes, and snippets.

@iorionda
Created December 10, 2015 02:23
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 iorionda/6894ee3d32e2bb37e986 to your computer and use it in GitHub Desktop.
Save iorionda/6894ee3d32e2bb37e986 to your computer and use it in GitHub Desktop.
fizzbuzz = fn
{true, true} -> 'FizzBuzz'
{true, false} -> 'Fizz'
{false, true} -> 'Buzz'
{false, false} -> nil
end
1..100 |> Enum.each fn(n) ->
case fizzbuzz.({rem(n, 3) == 0, rem(n, 5) == 0}) do
nil -> n
s -> s
end
|> IO.puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment