Skip to content

Instantly share code, notes, and snippets.

@bennycwong
Created January 11, 2016 07:10
Show Gist options
  • Select an option

  • Save bennycwong/5289079528666b7a8fcf to your computer and use it in GitHub Desktop.

Select an option

Save bennycwong/5289079528666b7a8fcf to your computer and use it in GitHub Desktop.
This is an implementation of FizzBuzz in Elixir
fizzbuzz = fn
0, 0, _ -> "FizzBuzz"
0, _, _ -> "Fizz"
_, 0, _ -> "Buzz"
_, _, n -> n
end
fb = fn
n -> fizzbuzz.( rem(n,3) , rem(n,5) , n) |> IO.puts
end
Enum.each 1..200, fn (x) -> fb.(x) end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment