[ Draft ]
Contents
Loop-related jumps are jumps used specifically inside a loop. Jumps are a form of control over execution flow. Loops are explained in the article Loops. Execution flow is explained in the article Execution Flow.
The following two forms of jump relate specifically to a loop:
- Exit Loop
- Continue
They each might be explained in their own article.
Loops-related jumps are a form of control over execution flow explained in the article Loop-Related jumps. The articles that follow only explain their expression in a diagram.
There are two forms of loop-related jump:
- Exit Loop
- Continue
Each form is explained in a separate article. See the articles Exit Loop in a Diagram, Continue in a Diagram.
The Continue statement is a loop-related jump. It is a jump that is only performed inside a loop.
Continue skips the remainder of the loop command and immediately moves on to the next repetition of a loop.
A loop command is implemented as a reference to a command, passed as an argument to an execution flow command. So Continue means no more, than to exit the command that is looped, so it is a synonym for Exit Command, but then used inside a loop.
It might remove the command that is exited from the call stack, and immediately jumps to the command referred to by the Command End, that was passed to it.
As explained in the article Continue, the Continue command means no more than to exit the command that is looped.
So in the expression in a diagram, you see a loop, that has the command to loop associated to it. A continue statement looks the same as to exit a command:
The Exit Loop statement is a loop-related jump. It is a jump that is only performed inside a loop.
Exit Loop omits all repetitions, that might have followed and immediately ends the complete loop.
Exit Loop is a jump to the Command End of the loop command. The Command End of a command is a reference to the next command to run, so the normal order that follows after the loop continues.
Do not confuse this with exiting the command that is being looped, because that causes the next repetition of the loop to run. That action is performed with the Continue command. The Exit Loop command ends the whole loop.
The implementation of the Exit Loop command is a lot like the implementation of Exit Command, only the Exit Loop command might delete the last two calls from the call stack, and immediately jumps to the command referred to by the Command End, that was passed to it.
The Exit Loop command is displayed inside the clause that is looped as a jump to the Command End of the whole loop.
The text Command End is not required in the diagram: