Skip to content

Instantly share code, notes, and snippets.

@douglas-mason
Last active December 21, 2015 08:59
Show Gist options
  • Save douglas-mason/6281935 to your computer and use it in GitHub Desktop.
Save douglas-mason/6281935 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
class FizzBuzz
def fizz_buzz_puts(number)
fb_string = ''
if number%3 == 0
fb_string += 'Fizz'
end
if number%5 == 0
fb_string += 'buzz'
end
fb_string = number if fb_string ==''
puts fb_string
end
end
fb = FizzBuzz.new
100.times do |i|
fb.fizz_buzz_puts i+1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment