How to write if condition in while loop to terminate it

While ( x == true ) {

   //some code

   if ([insert exist condition here]){
       x = false;
   );

}

Pay attention that the exist condition can be satisfied somehow, or ur code will run forever

Leave a Comment