Created
February 7, 2022 21:50
-
-
Save dscataglini/f9f057b29044cf26d1b5fbb72078a027 to your computer and use it in GitHub Desktop.
fizz buzz using Noise class
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
class Noise | |
def consider(number) | |
return 'fizzbuzz' if number % 15 == 0 | |
return 'fizz' if number % 3 == 0 | |
return 'buzz' if number % 5 == 0 | |
number | |
end | |
end | |
noise = Noise.new | |
(1..100).each do |i| | |
puts noise.consider(i) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment