In my code I have an if statement, if the condition is true I want to stop running the current method (function), and run the next one in the loop. I think the return statement would work, as the reference page says it terminates a function; I tried looking it up online, but all I could find was stuff about returning values. Would the return statement work to stop running the function, and run the next function in the loop? Thanks!
Would the return statement work to stop running the function,
and run the next function in the loop?
As its name implies, the return statement returns to where the function was called from. If called from loop() it will return there. If the function call is followed by another one then that will execute that function.
Why not try this for yourself ?
Thanks for your help!
If your function is declared void, then return is all you need. If your function is declared to return an int or a float or something else, then you better return an appropriate value.