Last active
August 10, 2016 06:43
-
-
Save ivancorrales/d4885aec095d18fc80effa97bbecc09b to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_fn = fn | |
(0, 0, _) -> "FizzBuzz" | |
(0, _, _) -> "Fizz" | |
(_, 0, _) -> "Buzz" | |
(_, _, c) -> c | |
end | |
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