do...while

名称

do…while

説明

do…while文は、制御式がループの最後に評価されることを除き、while文と同様の動作をする。このため、doループは最低でも1回は実行される。

書式

do {
  // statement block
} while (condition);

引数

conditiontrueかfalseと評価されるブール表現。

使用例

1
2
3
4
5
int x = 0;
do {
  delay(50);          // wait for sensors to stabilize
  x = readSensors();  // check the sensors
} while (x < 100);

参照

オリジナルのページ

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

Last Revision: 2019/07/22

最終更新日

January 4, 2024

inserted by FC2 system