From: Dave Burt Date: 2006-03-31T21:58:42+09:00 Subject: Re: Learn to Program, by Chris Pine JB wrote: > I'm stuck trying to do the part to make it do '99 bottles of beer on the > wall' song. I get started in what I hope will work and next thing I know I > have way too many variables and nothing makes sense. I even did something > that made it loop the integer 0. I had to Ctrl-c on that one. > > Here's what I quit trying at, because no matter how many breaks I took or > whatever, it just wasn't making any sense. : > ... > I too wish the author had put examples, say on some pages in the back or > something. But if you ask this group, you can get interactive answers! Let's start again with that one. We need a loop counting down from 99. So first, we need a counter. beer = 99 Now, we need to count it down. beer = beer - 1 But we need to do that repeatedly - it goes in a loop. beer = 99 while (something to end the loop?) beer = beer - 1 end How long should we keep looping? We don't want to go past zero. In other words, we loop while our counter is zero or more. beer = 99 while beer >= 0 beer = beer - 1 end OK, now we've got the basic structure of the program - one loop, beer starts at 99, and decreases until it gets to 0. But there's no output yet. See how you go putting some flesh on that skeleton, JB - post back when you're done. (I found learning to program it was better to write than read, so put aside Herr Froelich's solution and make your own!) Cheers, Dave