View Single Post
Another Option
Senior Member
MrMoke's Avatar
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Another Option - 03-13-2014, 03:03 PM

Another option might be to use a "While Loop".

Create a numeric variable called something like"bottles" and set to 99.
Start a "While" that loops as long as "bottles" is greater than zero.
Add your code to the While Loop.
The last two lines are "Take one down, pass it around.", and "(bottles-1) bottles etc...", so you decrement "bottles" variable between the two lines and avoid All the inline subtractions.

Other things you might want to consider:
1) Using int(bottles) to get rid of decimal positions in say commands.
2) Make the last statement in the Loop an If/Else statement that changes the last "say" line to "no Bottles left on the wall" when "bottles" eventually gets to zero.

Last edited by MrMoke; 03-14-2014 at 03:15 PM.
Reply With Quote