do while

do - while 回圈与 while 回圈相似,其最大的差别在于 do - while 回圈会先执行回圈中程式码再判断条件示成立与否。


  do
  {
     // 回圈区块
  } while (测试条件);

范例

do
{
  delay(50);          // 等待感测器变成稳定状态
  x = readSensors();  // 读取感测器

} while (x < 100);

语法参考主页面

本页由热血青年 LBU 译自英文版。

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.