Created
December 16, 2014 05:29
-
-
Save AllPurposeName/c86f1623ccc11a25383e to your computer and use it in GitHub Desktop.
99 bottles song
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
bottles = 100 | |
original_bottles = bottles | |
while bottles > 1 | |
bottles -= 1 | |
case | |
when bottles > 2 | |
puts "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down, pass it around, #{bottles - 1} bottles of beer on the wall." | |
else | |
puts "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down, pass it around, #{bottles - 1} bottle of beer on the wall." | |
break | |
end | |
end | |
puts "#{bottles - 1} bottle of beer on the wall, #{bottles - 1} bottle of beer.\nTake 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.\nGo to the store, buy some more, #{original_bottles - 1} bottles of beer on the wall." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment