Re: Learn to Program, by Chris Pine

First off, thanks to Dave for providing the explanation that should have
been in place of just my solution.

I also recommend putting the “beer = beer - 1” at the end of the loop
but that won’t immediately allow you to remove the if unless you also
look at changing the loop criteria or provide a special check to handle
the last time through the loop. Assuming you want to end with 0 bottles
of beer on the wall, then your last iteration through the loop will need
to be when beer = 1 which means you should also look to change your
while criteria. Either of the following would work:

While beer >= 1

Or

While beer > 0

Both of these will allow you to remove the extra if check.

Keep it up!

–Bill