Gentee Programming Language > Documentation > Syntax Download documentation

The label and goto Instructions

The label and goto insrustions perform an unconditional transfer of control in the function body.
The appearance of the label instruction in the source program declares a label. The keyword is followed by a name - an identifier label.

<label> ::= label <label name>

The goto instruction transfers control to the specified label.

<goto> ::= goto <label name>

The label has scope limited to the block in which it is declared, therefore the goto instruction transfers control to the label either inside the current block or in blocks of higher levels. Control transferred to the label may occur before the label is declared.

{
...
{
goto l1//Correct
...
label l1
...
goto l2//Correct
}
...
{
goto l1//Error
}
...
goto l1//Error
...
label l2
}

See also

    switch Statement


 Copyright © 2004-2006 Gentee Inc. All rights reserved.