lang • labels

Labels

Identifier :

A label indicates a target for the GOTO instruction.

A label is local to a function or procedure.

GOTO and labels can be used to leave a control structure.

For iY = 0 To 5
  For iX = 0 To 20 Step 1
    Print "Loop1 "; iX
      If iX = 3 Then Goto LOOP2
    Next
  Next
LOOP2:

But GOTO and labels cannot be used to enter a control structure. This is forbidden, even if the variables are preset.

iX = 18
' GOTO LOOP3   ' forbidden
For iX = 20 To -2 Step -2
LOOP3:
  Print "Loop2 "; iX
Next

See also