Skip to content

Instantly share code, notes, and snippets.

@cdimartino
Created December 1, 2022 18:42
Show Gist options
  • Save cdimartino/3003ce30061988ad18627fd9375c500c to your computer and use it in GitHub Desktop.
Save cdimartino/3003ce30061988ad18627fd9375c500c to your computer and use it in GitHub Desktop.
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!"
@cdimartino
Copy link
Author

51 instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment