-
-
Save animato/6cb60afe6c50006d4790f6da7d227a04 to your computer and use it in GitHub Desktop.
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
# 5-2 인자 세 개를 받는 함수 | |
fizz_buzz = fn | |
0, 0, _ -> "FizzBuzz" | |
0, _, _ -> "Fizz" | |
_, 0, _ -> "Buzz" | |
_, _, a -> a | |
end | |
# 5-3 FizzBuzz 함수 | |
fizzbuzz = fn | |
n -> fizz_buzz.(rem(n, 3), rem(n, 5), n) | |
end | |
IO.puts fizzbuzz.(10) | |
IO.puts fizzbuzz.(11) | |
IO.puts fizzbuzz.(12) | |
IO.puts fizzbuzz.(13) | |
IO.puts fizzbuzz.(14) | |
IO.puts fizzbuzz.(15) | |
IO.puts fizzbuzz.(16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment