for(inti=0;i<10;i++){if(i==4){continue;}cout<<i<<"\n";} 在While 循环中使用 Break 和 Continue 你也可以在while循环中使用break和continue: Break 示例 代码语言:cpp 复制 inti=0;while(i<10){cout<<i<<"\n";i++;if(i==4){break;}} Continue 示例 代码语言:cpp 复制 inti=0;while(...
Definition and Usage Thebreakkeyword is used to break out aforloop, or awhileloop. More Examples Example Break out of a while loop: i =1 whilei <9: print(i) ifi ==3: break i +=1 Try it Yourself » Related Pages Use thecontinuekeyword to end the current iteration in a loop, ...