Do... while

From Microduino Wiki
Jump to: navigation, search
  • do...while

The do loop is a bottom driven loop that works in the same manner as the while loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once.


do
{
//statements
}while(test condition);
  • Example

do
{
delay(50); //wait for the sensor to be stable
X = readSensors(); //check the value of the sensor 
 
}while(X <100);  //loops when x is less than 100


[Return to Arduino Syntax Manual]