The "While" Statement
The while statement repeats the given code as long as the given statement returns true. A while statement looks like this:
while(expression)
{
// do whatever
}
Here is an example of the while statement:
bool myVariable;
myVariable = false;
while(myVariable == false) // if myVariable is false, then it is true that myVariable is equal to false!
{
// this will repeat forever unless you say inside of the loop to break or set myVariable to true so that the expression is no longer true
}