User Tools

Site Tools


jvs:cigal:manual:chapter2:label

CIGAL Reference Manual, Chapter 2 (Commands): LABEL

LABEL -- Mark the target of a jump from a GOTO statement

usage: label labelnumber

A LABEL command is ignored when it appears during normal command processing. However, during the execution of a macro program, when a GOTO command of the form:

        GOTO labelnumber

is encountered, then the program jumps to the location of the LABEL command with the same LABELNUMBER as indicated by the GOTO. The next command to be executed is the line following that LABEL.

There are 3 important restrictions on the values used for LABELNUMBERs:

   1) Label values must be positive integers.
   2) Label values must be specified as CONSTANTS, not variables or macro
      arguments.  This is because variables are not evaluated until a
      command is executed, whereas the compiler needs to know the label
      numbers ahead of time.  Thus, 'label 100' is valid, but 'label a' is
      not.  (This would only generate an error if you compile however.)
   3) To make finding the label more efficient, label values must appear in
      increasing order within a macro program.  You will get a "can't find
      the line label" error if your label values jump up and down.

NOTE: GOTO and LABEL statements are only intended for special occasions since it is almost always easier to control the flow of program execution using IF and WHILE commands with blocks of code specified within {}'s. See IF(2), ELSE(2), WHILE(2), BREAK(2), and NEXT(2) for more information.

See Also:
BREAK(2), ELSE(2), IF(2), NEXT(2), WHILE(2)

CIGAL Home, CIGAL Manual, Commands List, Manual Help

jvs/cigal/manual/chapter2/label.txt · Last modified: 2023/02/23 18:43 (external edit)