Skip to content

Instantly share code, notes, and snippets.

@AllPurposeName
Created December 16, 2014 05:29
Show Gist options
  • Save AllPurposeName/c86f1623ccc11a25383e to your computer and use it in GitHub Desktop.
Save AllPurposeName/c86f1623ccc11a25383e to your computer and use it in GitHub Desktop.
99 bottles song
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