Hi David,
Starting statements before the while loop is one way to go. After re-evaluating my submission for this project, I chose to run all of my statements within my while loop. In fact, to have better error control, I used a while loop within a while loop as follows:
Think of the variables count1 and count2 as on/off switches, 1=on, 2=off. Except these variables kill or start the appropriate while loop.
count1 = 1;
count2 = 2;
spins = 1;
playAgain = default string;
// Start of main loop
while count1 == 1
spins = ask user for a number; if spins <= 10
character spins around
// Kill main loop
count1 == 2
// Start loop 2
count2 == 1
else if spins > 10
character says "Number is too high"
// Start of loop 2
while count2 == 1
playAgain = "Would you like to play again?";
if playAgain == yes, Yes, or YES
// Restart main loop
count1 == 1
// Kill loop 2
count2 == 2
else if playAgain == no, No, or NO
character says "goodbye!"
// Kill both loops
count == 2
count == 2
else
character says "I don't understand that answer. Please try again."
// End of loop 2
// End of main loop
This way I was able to control the program in case the user input a number higher than 10 and something other than yes, Yes, YES, or no, No, NO. There are other error controls I could implement such as if the user inputs something other than a number or a negative number ... but this will do for now.
Of course this isn't the only way to do this, but I felt my code was cleaner and easier to work with than trying to nest a whole bunch of if/else statements in one while loop.