Created
December 1, 2022 18:42
-
-
Save cdimartino/3003ce30061988ad18627fd9375c500c 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
def solution(number) | |
{ | |
15 => "FizzBuzz", | |
5 => "Buzz", | |
3 => "Fizz", | |
}.select { number % _1 == 0 }.map { _2 }.first | |
end | |
raise unless solution(3) == "Fizz" | |
raise unless solution(5) == "Buzz" | |
raise unless solution(15) == "FizzBuzz" | |
puts "It works!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
51 instructions