break
原文
breakはwhile、for、doなどのループから、通常のループ状態をバイパスして抜け出す場合に使用します。
また、switch文にも使用されます。
利用例
code:bleakSample.ino
for (x = 0; x < 255; x ++)
{
digitalWrite(PWMpin, x);
sens = analogRead(sensorPin);
if (sens > threshold){ // bail out on sensor detect
x = 0;
// this line of code means that we'll immediately exit
// from the "for" loop:
break;
}
delay(50);
}
関連項目]
for
while
do
License and Attribution: Portions of this page were adapted from the Arduino Reference Documentation, which is released under a Creative Commons Attribution-ShareAlike 3.0 License.
このドキュメントはleafLabs, LLC.が執筆し、たま吉が翻訳・一部加筆修正したものです。
Arduino STM32 リファレンス 日本語版 に戻る