#!/usr/bin/ruby # @song= "" @ss = "" def sing_for(bottles) if (bottles > 1) then @ss = "s" end # @song.<<("#{bottles}"+" bottle"+ @ss + " of beer on the wall. ") @song.<<("#{bottles}"+" bottle"+ @ss + " of beer. ") @song.<<("Take one down, pass it around. ") @song.<<("#{bottles}"+" bottle"+@ss+" of beer on the wall.") @song end [3, 2, 1].each do |beer| p sing_for(beer) end