jessicakennedy1028 icon

Beer Song!

jessicakennedy1028 | PRO | 09/14/18 03:43:38 PM UTC | 0 ⭐ | 6958 👁️ | Never ⏰ | []
Ruby |

720 B

|

None

|

0 👍

/

0 👎

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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎