Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 819 Bytes

5.21.continue.md

File metadata and controls

21 lines (14 loc) · 819 Bytes

5.21.continue

continue关键字结束它所声明的最深处的当前迭代,使循环条件被检查于下一次迭代:

The continue keyword ends the current iteration of the innermost loop (for or while) it is declared in, causing the loop condition to be checked for the next iteration:

while(true) { 
    expression1; 
    if(condition) continue; 
    expression2; 
} 

这里,expression1每次迭代都被执行,但是如果条件满足,expression2不再为当前迭代执行。不像break,迭代仍然继续。

Here, expression1 is evaluatedfor each iteration, but if condition holds, expression2 is not evaluated for the current iteration. Unlike break, iterations continue.

类型工具确保它只出现在循环中。

The typer ensures that it appears only within a loop.