用户工具

站点工具


reference:language:continue
no way to compare when less than two revisions


前一修订版
reference:language:continue [2023/06/07 04:23] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 +====== continue ======
 +
 +continue语句跳过当前循环中剩余的迭代部分( do,for 或 while )。它通过检查循环条件表达式,并继续进行任何后续迭代。
 +===== 例子 =====
 +<code cpp> 
 +for (x = 0; x < 255; x ++)
 +{
 +    if (x > 40 && x < 120){      // 当x在40与120之间时,跳过后面两句,即迭代。
 +        continue;
 +}
 + 
 +    digitalWrite(PWMpin, x);
 +    delay(50);
 +}
 +</code>
 +
  
reference/language/continue.txt · 最后更改: 2023/06/07 04:23 由 127.0.0.1