[prev] [prev-tail] [tail] [up]

#### Goto statements

Free Pascal supports the goto jump statement. Its prototype syntax is

_________________________________________________________________________________________________________ Goto statement
___________________________________________________________________

When using goto statements, the following must be kept in mind:

1. The jump label must be defined in the same block as the Goto statement.
2. Jumping from outside a loop to the inside of a loop or vice versa can have strange effects.
3. To be able to use the Goto statement, the -Sg compiler switch 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;
     ...

[prev] [prev-tail] [front] [up]