Labels

A label gives a name to a statement. A label is built in the same way as an identifier.

These statements transfer control to a labeled statement by referring to its label:

  • GoSub
  • GoTo
  • If...GoTo
  • On Error
  • On...GoSub
  • On...GoTo
  • Resume

The following rules govern the use of labels in a script:

  • A label can only appear at the beginning of a line. It labels the first statement on the line.
  • A label can appear on a line by itself. This labels the first statement starting after the line.
  • The last character of a label must be a colon (:).
  • A label can't be suffixed with a data type suffix character.
  • A given statement can have more than one label preceding it; but the labels must appear on different lines.
  • A given label can't be used to label more than one statement in the same procedure.