puts; puts " It's beer song time!"; puts
@count = 99
@container = "bottle"
@getDrunkBy = @count - 10
def bottles(n, container)
n == 1 ? "#{n} #{container}" : "#{n} #{container}s"
end
def getDrunk(str, n, by)
by <= n ? str : str.split(' ').shuffle.join(' ').capitalize
end
@count.downto(1) {
puts <<BEERSONG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#{bottles(@count, @container)} of beer on the wall
#{bottles(@count, @container)} of beer
#{getDrunk('Take one down pass it around', @count, @getDrunkBy)}
#{bottles(@count -= 1, @container)} of beer on the wall
BEERSONG
}
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
puts; puts " No more beer on the wall :-("
puts " And I'm on the floor"
Comments
0 B
|👍
/👎
0 B
|👍
/👎