Skip to content

Instantly share code, notes, and snippets.

@danvideo
Last active January 7, 2020 03:00
Show Gist options
  • Save danvideo/7244313 to your computer and use it in GitHub Desktop.
Save danvideo/7244313 to your computer and use it in GitHub Desktop.
X Bottles of Beer on the Wall
class BottlesOfBeer
def count_off
puts "How many bottles of beer have you got? "
numbers = gets.chomp.to_i
numbers.downto(1) 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
end
bottle = BottlesOfBeer.new
bottle.count_off
end
@octosteve
Copy link

My try! https://gist.github.com/StevenNunez/7253815 The first one is more readable...

@danvideo
Copy link
Author

ha - great. don't have ruby on my office computer so trying to map it out in my head... definitely need to take a deeper look later

@octosteve
Copy link

The short one was a bit obtuse on purpose. The word you want to look for is lambda

@christianmendoza
Copy link

Late to the party but here's my attempt! https://gist.github.com/christianmendoza/7293928

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment