Skip to content

Instantly share code, notes, and snippets.

@GusGA
Created September 18, 2015 12:20
Show Gist options
  • Save GusGA/68796d26c9c8ce466067 to your computer and use it in GitHub Desktop.
Save GusGA/68796d26c9c8ce466067 to your computer and use it in GitHub Desktop.
FizzBuzz Code in Elixir
defmodule FizzBuzz do
def start do
IO.inspect Enum.map(1..100, fizz_or_buzz)
end
def fizz_or_buzz(n) do
cond do
rem(n,15) == 0 -> "FizzBuzz"
rem(n,5) == 0 -> "Buzz"
rem(n,3) == 0 -> "Fizz"
true -> n
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment