这里会显示出您选择的修订版和当前版本之间的差别。
前一修订版 | |||
— | en:reference:language:break [2023/06/07 04:23] (当前版本) – 外部编辑 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== break ====== | ||
+ | |||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | ===== Example ===== | ||
+ | <code cpp> | ||
+ | for (x = 0; x < 255; x ++) | ||
+ | { | ||
+ | digitalWrite(PWMpin, | ||
+ | sens = analogRead(sensorPin); | ||
+ | if (sens > threshold){ | ||
+ | x = 0; | ||
+ | | ||
+ | } | ||
+ | delay(50); | ||
+ | } | ||
+ | </ | ||