Free Pascal supports the goto jump statement. Its prototype syntax is
_________________________________________________________________________________________________________
Goto statement
___________________________________________________________________
When using goto statements, the following must be kept in mind:
- The jump label must be defined in the same block as the Goto statement.
- Jumping from outside a loop to the inside of a loop or vice versa can have strange
effects.
- To be able to use the Goto statement, the -Sg compiler switch must be used, or {$GOTO
ON} must be used.
Goto statements are considered bad practice and should be avoided as much as possible. It is
always possible to replace a goto statement by a construction that doesn’t need a goto, although
this construction may not be as clear as a goto statement. For instance, the following is an allowed
goto statement:
label
jumpto;
...
Jumpto :
Statement;
...
Goto jumpto;
...