continue

名称

continue

説明

continue文は、現在の繰り返し実行のループ(for文や、while文、do…while)の残りを実行せず、ループの制御式の評価へと制御を移し、次の繰り返し実行のループを実行する。

使用例

以下のコードでは、PWMpinに0から255の値を書き込む。ただし、41から119の間は書き込まない。

1
2
3
4
5
6
7
8
for (int x = 0; x <= 255; x ++) {
  if (x > 40 && x < 120) {  // create jump in values
    continue;
  }

  analogWrite(PWMpin, x);
  delay(50);
}

参照

オリジナルのページ

https://www.arduino.cc/reference/en/language/structure/control-structure/continue/

Last Revision: 2019/07/22

最終更新日

January 4, 2024

inserted by FC2 system