99 bottles of beer...pg57

Nice
Thanks

···

----- Original Message ----
From: Shiloh Madsen <shiloh.madsen@gmail.com>
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Sent: Tuesday, November 7, 2006 11:50:35 AM
Subject: Re: 99 bottles of beer...pg57

Hi Jamison, I came up with a shorter version. I think it is more
efficient, but I am about as new as you are. Here was my code:

bottles = 99
while bottles > 0
    puts bottles.to_s + " bottles of beer on the wall, " + bottles.to_s +
" bottles of beer. Take one down and pass it around, " + (bottles
= bottles - 1).to_s + " bottles of beer."
end

On 11/7/06, jamison edmonds <jamison2000e@yahoo.com> wrote:

Hi

I'm reading the book Learn to Program, by Chris Pine. I
wanted to see if my program 99 bottles of beer on the wall, from (pg.57 or http://pine.fm/LearnToProgram/?Chapter=06 ) is
o.k.?

An online search thru Google found Ruby-Talk, and I
instantly bookmarked it.

Now I'm on the list.

Any thoughts would be appreciated :wink:

Hears my try at it

Thanks

puts
puts '99, Bottles of beer on the wall, 99 bottles of beer,'
puts 'take one down, pass it around,'
first = 99
while first != 1
    if first != 1
      first = first -1
    end
  puts first.to_s + ' Bottles of beer on the wall, ' + first.to_s + ' bottles of beer,'
  puts 'take one down pass it around,'
end
puts '0,Bottles of beer on the wall ;)'