“Break”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
(以“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. <font color="orange" siz...”为内容创建页面)
 
(没有差异)

2015年7月31日 (五) 20:12的最后版本

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论坛