Created
September 12, 2011 21:47
-
-
Save havenwood/1212561 to your computer and use it in GitHub Desktop.
FizzBuzz
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 Integer | |
def check | |
case | |
when self % 15 == 0 | |
puts "Fizzbang" | |
when self % 3 == 0 | |
puts "Fizz" | |
when self % 5 == 0 | |
puts "Bang" | |
else | |
puts self | |
end | |
end | |
end | |
def fizz this | |
this.each(&:check) | |
end | |
fizz 1..100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment