C++ Programming Code Examples C++ > For Loops and While Loops Code Examples For finite loops we should have an expression which should give a false value some how. For finite loops we should have an expression which should give a false value some how. In below code the expression will give false value if value of x will be greater than or equal to 10. Since we are incrementing value of x so after some time condition x < 10 will return false and while loop will terminate. int x = 0; while (x < 10) // the condition is "x < 10" { ++x; // statement executed in loop } cout << "Now x is " << x << endl;