break - exits the loop immediately, and unconditionally
ends the loop's operation, the program begins to execute the nearest
instruction after the loop's body.
continue - behaves as if the program has suddenly reached
the end of the body, the next turn is started and the condition expression is
tested immediately.
Example 1 –
Output is
Example 2 –
Output is
Example 3 –
Output is
Example 4 –
Output is
Example 5 –
Output is
The loop's "else" branch is always executed once, regardless of
whether the loop has entered its body or not.
If the control variable
doesn't exist before the loop starts, it won't exist when the execution reaches the "else" branch.
No comments:
Post a Comment