Why won't Bottlesofbeer work?

Asked by squazzie 12 months ago

100 bottles of beer on the wall

root beer, naturally...

This sings a line of the song

def sing_line(verse_number, line_number) case line_number when 1

puts "#{verse_number} bottles of beer on the wall"

when 2

puts "#{verse_number} bottles of beer"  

when 3

puts "Take one down, pass it around"

when 4

puts "#{verse_number - 1} bottles of beer on the wall!"

end # Wait a second so that someone can read the line time = Time.now time_now = Time.now until time_now - time > 1.5

time_now = Time.now
# Twiddle the processor's thumbs while we wait...

end end

def sing_verse(verse_number) (1..4).each { |line_number| sing_line(verse_number, line_number) } end

def sing_song(number_of_verses) until number_of_verses < 1

sing_verse(number_of_verses)
number_of_verses -= 1

end end

sing_song(100)

1 response

  • enrique says

    Hi squazzie - I'm putting your code into HH to try out when I'm travelling tomorrow.

    I'll see how it goes and post back.