Check out example codes for "while loops c++". It will help you in understanding the concepts better.

Code Example 1

while(condition)
{
   statement(s);
}

Code Example 2

while (condition) {

      // code block to be executed

 }

Code Example 3

while (x != 0){ ... }

Code Example 4

while (x){ ... }

Code Example 5

int i = 0;
while (i < 5) {

    cout << i << "\n";

  i++;
}

Code Example 6

while(/*Expression*/){
 //Statements go here
}

Learn ReactJs, React Native from akashmittal.com