Break

From Microduino Wiki
Jump to: navigation, search
  • break

Break is used to exit do, for, and while loop, and it can skip the common judge condition. And it can also exit the switch statement.

  • Example

for (x = 0; x < 255; x ++)
{
    digitalWrite(PWMpin, x);
    sens = analogRead(sensorPin);  
    if (sens > threshold){      // beyond test range
       x = 0;
       break;
    }  
    delay(50);
}

[Return to Arduino Syntax Manual]