# Re: Learn to Program, by Chris Pine

**URL:** <https://www.ruby-forum.com/t/re-learn-to-program-by-chris-pine/56446>\
**Category:** Ruby\
**Created:** [March 31, 2006, 8:39am UTC](https://www.ruby-forum.com/t/re-learn-to-program-by-chris-pine/56446 "2006-03-31T08:39:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_SBillS\_Froe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@William\_SBillS\_Froe](https://www.ruby-forum.com/u/William_SBillS_Froe)\
**Post date:** [March 31, 2006, 8:39am UTC](https://www.ruby-forum.com/t/re-learn-to-program-by-chris-pine/56446/1 "2006-03-31T08:39:00Z")

</div>

How’s this for a solution. Note I tried to only use constructs covered  
up to the point of the exercise in the book.

numBottles = 99  
while numBottles \> 2  
puts numBottles.to\_s + " bottles of beer on the wall, " +  
numBottles.to\_s + " bottles of beer,"  
puts “take one down, pass it around, " + (numBottles-1).to\_s + "  
bottles of beer on the wall!”  
puts “”  
numBottles = numBottles - 1  
end  
puts numBottles.to\_s + " bottles of beer on the wall, " +  
numBottles.to\_s + " bottles of beer,"  
puts “take one down, pass it around, " + (numBottles-1).to\_s + " bottle  
of beer on the wall!”  
puts “Yay!”

–Bill

---

<div class="post-metadata">

**Author:** ![William\_SBillS\_Froe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@William\_SBillS\_Froe](https://www.ruby-forum.com/u/William_SBillS_Froe)\
**Post date:** [March 31, 2006, 10:41am UTC](https://www.ruby-forum.com/t/re-learn-to-program-by-chris-pine/56446/2 "2006-03-31T10:41:46Z")

</div>

William (Bill) Froelich wrote:

> numBottles = numBottles - 1  
> end  
> puts numBottles.to\_s + " bottles of beer on the wall, " +  
> numBottles.to\_s + " bottles of beer,"  
> puts “take one down, pass it around, " + (numBottles-1).to\_s + " bottle  
> of beer on the wall!”  
> puts “Yay!”
> 
> –Bill

Wow! It was so simple once I saw how it should/could be done! I’d (for  
some  
reason) completely forgot to do the ‘+ +’ thing in a ‘puts’!  
I’m  
terrible at learning things, having severe ADHD, so if you don’t tire of  
helping me, I won’t tire of still trying to learn programming.

One question though about something that’s got me still a little  
confused.  
Why the ‘while numBottles \> 2’ ?

Anyway, I really do appreciate the help Bill! Thank you very much!
