I always have problem with placing ;
at the end of while
or not placing it at the end of do while
loops. So what's the reason? Why
int numItemsToProcess = 3;
while(numItemsToProcess > 0)
{
// process an item
numItemsToProcess--;
}
doesn't need ;
at the end but
do
{
numItemsToProcess --;
} while (numItemsToProcess > 0);
does?
Maybe the reason is not too important. but when you know the reason you can remember where to put ;
.