Jump Statement
Jump statements are statements that can stop the execution of a function or a loop (while-loops, do-while-loops or for-loops) prematurely.
Jump statements must always have a valid target (parent statement) that can be determined at compile time, otherwise the statement is invalid and an error will be thrown.
These jump statements are:
-
break
- Stops a while-loop, do-while-loop or for-loop. -
return
- Returns from a functions with an optional specific return value (Must match function return type). -
continue
- Jumps directly to the execution of the next loop cycle and will compare the loop-condition again.
Syntax
// Only valid in functions
return VALUE(OPTIONAL); // 'VALUE' is only required if the return type of the function is not 'void'
// Only valid in loops
break;
// Only valid in loops
continue;