Last active
December 19, 2015 10:39
-
-
Save mattsears/5941887 to your computer and use it in GitHub Desktop.
This file contains 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 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