我想找...

搜尋

分享

目錄

do…while

[Control Structures]

描述

關於 do…​while loop works in the same manner as the while loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once.

語法

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

參數

condition: a boolean expression that evaluates to true 或 false.

範例程式碼

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

語法參考主頁面

86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。

返回頂端