Skip to content

Instantly share code, notes, and snippets.

@mizukmb
Last active August 29, 2015 14:23
Show Gist options
  • Save mizukmb/0b8a995ea8c7ee556afc to your computer and use it in GitHub Desktop.
Save mizukmb/0b8a995ea8c7ee556afc to your computer and use it in GitHub Desktop.
Written by Elixir
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