-
-
Save chriskuruc/7244582 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 BottlesOfBeer | |
def count_off | |
puts "How many bottles of beer have you got? " | |
bottles = gets.chomp.to_i | |
bottles.downto(2) do |number| | |
puts "#{number} bottles of beer on the wall, #{number} bottles of beer! Take one down, pass it around, #{number-1} bottles of beer on the wall!" | |
end | |
puts "1 bottle of beer on the wall, 1 bottle of beer! Take one down, pass it around, No more bottles of beer on the wall!" | |
puts "No more bottles of beer on the wall, no more bottles of beer! Go to the store and buy some more, #{bottles} bottles of beer on the wall!" | |
end | |
end | |
bottle = BottlesOfBeer.new | |
bottle.count_off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment