Created
February 3, 2013 06:02
-
-
Save anonymous/4700694 to your computer and use it in GitHub Desktop.
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
# Chris Pine did this | |
num_at_start = 5 # change to 99 if you want | |
num_now = num_at_start | |
while num_now > 2 | |
puts num_now.to_s + ' bottles of beer on the wall, ' + | |
num_now.to_s + ' bottles of beer!' | |
num_now = num_now - 1 | |
puts 'Take one down, pass it around, ' + | |
num_now.to_s + ' bottles of beer on the wall!' | |
end | |
puts "2 bottles of beer on the wall, 2 bottles of beer!" | |
puts "Take one down, pass it around, 1 bottle of beer on the wall!" | |
puts "1 bottle of beer on the wall, 1 bottle of beer!" | |
puts "Take one down, pass it around, no more bottles of beer on the wall!" | |
# Below is what I did. Am I wrong? | |
i = 99 | |
while i > 2 | |
puts "#{i} bottles of beer on the wall, #{i} bottles of beer." | |
i = i - 1 | |
puts "Take one down and pass it around, #{i} bottles of beer on the wall." | |
end | |
puts "2 bottles of beer on the wall, 2 bottles of beer." | |
puts "Take one down and pass it around, 1 bottle of beer on the wall." | |
puts "1 bottle of beer on the wall, 1 bottle of beer." | |
puts "Take one down and 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. " | |
puts "Go to the store and buy some more, 99 bottles of beer on the wall." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment