Job Management Partner 1/Software Distribution Automatic Installation Tool Description and Reference

[Contents][Glossary][Index][Back][Next]

3.6.1 goto

The goto statement provides an unconditional jump to a valid label position declared in the same section.

Organization of this subsection
(1) Format
(2) Description
(3) Example of coding
(4) Notes

(1) Format

Statements
Jump statement
Label statement

Jump statement
goto identifier;

Label statement
identifier:

(2) Description

The goto statement is used to exit deeply nested loops directly. Compare, while the break statement is used to exit only one nesting level of repetitive statements.

(3) Example of coding

//MAIN section
MAIN
{
   ...
   ...
   AIT_LogMessage("LBL030: JUMP TO LABEL");
   goto label1;
       AIT_LogMessage("LBL030: NOT DISPLAYED 1");       // Not executed
 
       label1:                        // The control shifts here.
          AIT_LogMessage("LBL030: JUMPING TO LABEL ");  // Executed
}

(4) Notes

For better programming, you should use the break, continue, or return statement rather than the goto statement wherever possible.