Skip to content

Instantly share code, notes, and snippets.

@madebydna
Forked from ruanwz/lyric.rb
Created August 26, 2010 23:12
Show Gist options
  • Save madebydna/552439 to your computer and use it in GitHub Desktop.
Save madebydna/552439 to your computer and use it in GitHub Desktop.
class Song
def initialize
@bottles = 99
end
def sing
@bottles.downto(0) do |bottle|
if bottle > 1
puts "#{bottle} bottles of beer on the wall, #{bottle} bottles of beer."
puts "Take one down and pass it around, #{bottle - 1} bottles of beer on the wall.\n"
elsif bottle == 1
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."
elsif bottle == 0
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."
end
end
end
end
Song.new.sing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment