while (condition)
{
...
}
As in the if statement, the condition used in a while must be some expression that produces a boolean value. The statements between the open and closed curly brackets are known as the body of the loop.
A common way the while loop is used is as follows:
while (condition)
{
do something
change some variable so that next time you do something a bit differently
}