while 回圈
描述
在 while 回圈中的程式码会持续地执行,直到 () 中的条件式不成立。回圈执行期间必须要改变条件式的变数值,如递增的变数、检查感测器等外部条件等,否则可能会无法离开 while 回圈。
语法
while(expression){
// statement(s)
}
参数
expression 判断其条件成立与否
范例
var = 0;
while(var < 200){
// 持续累加 var 变数共 200 次
var++;
}
See also
- While Loop Tutorial in the Arduino Examples
本页由热血青年 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.
