Is there a way to go to the start of the void loop() function kind of like a "continue" keyword in c in loops? I am new to Arduino programming and am trying to make an obstacle avoiding car with an ultrasonic sensor and a differential driver model. While learning how to code it, I learned that you can exit the void loop() function with an exit(0) to terminate the program analogous to break keyword in C language.
Is there anything similar that I can use to mimic the &quot;continue&quot; keyword, say if I don't want to run the code after a particular line in the void loop() function.
In the loop() function, return will perform that function. By exiting the function, the for() loop in main() (which we don't see) will iterate again, calling loop() again.
Another way to accomplish the same thing is to write everything in your setup() function, including whatever kind of loop construct you want, and use break; and continue; statements as you're used to:
void setup(){
   // pinMode() &amp; digitalWrite() calls
   // Initialize the Serial port if you need to
   // Any other one-time setup
   //
   // Everything happens here:
   for( .... ){
      // loop contents here
      if( whatever ){
         continue;
      }
      else if( something_else ){
         break;
      }
   }
}

// This just stalls forever when setup() ends:
void loop(){
   ;
}