Break

来自YFRobotwiki
2015年7月31日 (五) 20:12Admin讨论 | 贡献的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

break is used to exit from a do, for, or while loop, bypassing the normal loop condition. It is also used to exit from a switch statement.


示例


for (x = 0; x < 255; x ++)
{
    analogWrite(PWMpin, x);
    sens = analogRead(sensorPin);  
    if (sens > threshold){      // bail out on sensor detect
       x = 0;
       break;
    }  
    delay(50);
}




返回Arduino语法参考列表

更多建议和问题欢迎反馈至 YFRobot论坛