while (i < 5) { i++; if (i === 3) continue; text += i + ""; } Try it Yourself » More examples below.DescriptionThe continue statement breaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop.The difference...
Continue in While Loop Thecontinuestatement stops the current iteration in thewhileloop and continue with the next. Continue Example Move to next iteration if$x= 4: $x=0;while($x<10){if($x==4){continue;}echo"The number is:$x";$x++;} Try it...
Break and Continue in While Loop You can also usebreakandcontinuein while loops: Break Example inti =0; while(i <10) { cout << i <<"\n"; i++; if(i ==4) { break; } } Try it Yourself » Continue Example inti =0;
Break and Continue in While Loop You can also usebreakandcontinuein while loops: Break Example inti=0;while(i<10){System.out.println(i);i++;if(i==4){break;}} Try it Yourself » Continue Example inti=0;while(i<10){if(i==4){i++;continue;}System.out.println(i);i++;} ...