Last active
August 29, 2015 14:23
-
-
Save mizukmb/0b8a995ea8c7ee556afc to your computer and use it in GitHub Desktop.
Written by Elixir
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 fizzbuzz(num) when rem(num, 15) == 0, do: "fizzbuzz" | |
def fizzbuzz(num) when rem(num, 3) == 0, do: "fizz" | |
def fizzbuzz(num) when rem(num, 5) == 0, do: "buzz" | |
def fizzbuzz(num), do: Integer.to_string num | |
end | |
Enum.each(1..100, fn(i) -> | |
IO.puts FizzBuzz.fizzbuzz(i) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment