Skip to content

Instantly share code, notes, and snippets.

@mattsears
Last active December 19, 2015 10:39
Show Gist options
  • Save mattsears/5941887 to your computer and use it in GitHub Desktop.
Save mattsears/5941887 to your computer and use it in GitHub Desktop.
defmodule Fizzbuzz do
def of(num) do
cond do
rem(num, 15) == 0 -> "FizzBuzz"
rem(num, 5) == 0 -> "Buzz"
rem(num, 3) == 0 -> "Fizz"
true -> num
end
end
end
Enum.map((1..100), fn(x) -> IO.puts Fizzbuzz.of(x) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment