Skip to content

Instantly share code, notes, and snippets.

@jots
Created October 29, 2015 23:47
Show Gist options
  • Save jots/50e44ade18e53ed9afdb to your computer and use it in GitHub Desktop.
Save jots/50e44ade18e53ed9afdb to your computer and use it in GitHub Desktop.
defmodule FizzBuzz do
def fizzbuzz(n) when rem(n, 15) == 0, do: "FizzBuzz"
def fizzbuzz(n) when rem(n, 5) == 0, do: "Buzz"
def fizzbuzz(n) when rem(n, 3) == 0, do: "Fizz"
def fizzbuzz(n), do: n
end
Enum.map(1..100, &FizzBuzz.fizzbuzz/1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment