I want to make a check before I execute some code in a script because the checks I had beforehand might now (due to some elapsed time) not be true anymore. Is there a way for me, within that if statement check, to break from the script and return control to a function in another script?
To manually exit out of a function at any time, use the ‘return’ keyword. Even for void functions (functions with no explicit return type), it is possible to cancel execution like this!
Along with that, there are the ‘break’ and ‘continue’ keywords for controlling execution from within a loop- ‘break’ automatically skips to the end of the entire loop, and ‘continue’ skips to the end of that particular iteration.