Jump Statements
Sometimes you need to control the process in a different way
than by decision based on the Condition
value.
To do that, you have the following options:
Break Statement
If you want to jump out of a loop or of a switch, you can use the following statement in the program:
break;
The processing of a loop (or switch) is relinquished and it continues with
Statements
following the loop or switch.
Continue Statement
If you want to stop processing of some iteration and go to next one, you can use the following statement in the program:
continue;
The processing jumps to the end of a loop, iteration is performed (in for loop) and the processing continues with next iteration step.
Return Statement
In the functions, you can use the return
word either alone
or along with an expression
.
(See the following two options below.)
The return
statement can be in any place within the function.
There may also be multiple return
statements among which a specific one is executed
depending on a condition, etc.
return;
return expression;