Last active
January 7, 2020 03:00
-
-
Save danvideo/7244313 to your computer and use it in GitHub Desktop.
X Bottles of Beer on the Wall
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 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 |
The short one was a bit obtuse on purpose. The word you want to look for is lambda
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
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