William (Bill) Froelich wrote:
> 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
Wow! It was so simple once I saw how it should/could be done! I'd (for some
reason) completely forgot to do the '+ <whatever> +' 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!