Is changing the currentLoc variable with an IF statement a bad way to terminate this loop below? I'm told:
"...something in the loop body must cause the expression to become false at some time. One of the things you do not do ever, is write an if statement to change the loop control variable to make the condition false."
Any info would be appreciated. And I apologize beforehand is this format is wrong. I've read the rules, but I *think* this is my first post here.
while (currentLoc != 1 && currentLoc != 8) //
{
((rand() % 100) < chanceNum ) ? currentLoc-- : currentLoc++;
if ( currentLoc == 1)
pubCount++;
else if (currentLoc == 8)
homeCount++;
blocksWalked++;
}