while

while (expression)

{

       coding;

}

 

If expression is true then the block is executed and we start over again.  The while statement repeats the block until expression is false.  It is easy to get into an infinite loop with while statements, it is very important that a variable is used in the expression and that inside the block there is a reference that changes the variable in the expression.  If the while statement gets into an infinite loop then the program will freeze up.  If this happens you will need to bring up the task manager and manually end the process.

 

Example:

while (timer > 0)

{

timer -= 1

// coding goes here that will repeat until time = 0;

}

 

Abyssal_Nuclei - Revision #1