Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created September 12, 2011 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/1212561 to your computer and use it in GitHub Desktop.
Save havenwood/1212561 to your computer and use it in GitHub Desktop.
FizzBuzz
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