Skip to content

Instantly share code, notes, and snippets.

Last active Aug 10, 2016
What would you like to do?
Implement a function that takes three arguments. If the first two are zero, return “FizzBuzz.” If the first is zero, return “Fizz.” If the second is zero, return “Buzz.” Otherwise return the third argument.
test_fn = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, c) -> c
IO.puts test_fn.(0,0,1)
IO.puts test_fn.(0,1,1)
IO.puts test_fn.(1,0,1)
IO.puts test_fn.(2,3,4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment