Re: 99 bottles of beer...pg57

ya the books and I aren’t quite there yet, put it wont be
long with this ml helping.

Thanks

----- Original Message ----
From: Phrogz [email protected]
To: ruby-talk ML [email protected]
Sent: Tuesday, November 7, 2006 12:15:13 PM
Subject: Re: 99 bottles of beer…pg57

On 11/7/06, jamison edmonds [email protected] wrote:

Any thoughts would be appreciated :wink:

Instead of using a ‘while’ loop (unless that’s what the book is
teaching you) I think the following is more Ruby-esque:

99.downto( 1 ) do |num|
puts “#{num} bottles of beer on the wall, #{num} bottles of beer,”
puts “take one down, pass it around,”
end
puts ‘0,Bottles of beer on the wall ;)’

Note the use of string interpolation also instead of .to_s and +

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs