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.


示例


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