Skip to content

Instantly share code, notes, and snippets.

@bryanwoods
Created July 6, 2015 21:27
Show Gist options
  • Save bryanwoods/337f173935a35968fe29 to your computer and use it in GitHub Desktop.
Save bryanwoods/337f173935a35968fe29 to your computer and use it in GitHub Desktop.
Logic free FizzBuzz in Elixir
fizz_word = fn
0, 0, _ -> "FizzBuzz"
0, _, _ -> "Fizz"
_, 0, _ -> "Buz"
_, _, x -> x
end
fizz_buzz = fn n -> fizz_word.(rem(n, 3), rem(n, 5), n) end
Enum.each 1..100, fn(n) -> IO.puts(fizz_buzz.(n)) end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment