CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Labels

Labels

Labels can be used to divide a large CitectVBA function or subroutine into logical sub-sections of code script. Labels are often used in association with the GoTo statement. All of the CitectVBA script following the label and extending through to another label, or to the end of the function or subroutine containing the label, is regarded as belonging to that label. Or more appropriately, the label is said to identify, or be attached to, that particular section of CitectVBA script.

Labels must begin with a letter, be no longer than 40 characters, and cannot be a reserved word. Labels must terminate with the colon character (:). Label names can only contain the letters 'A' to 'Z' and 'a' to 'z', the underscore '_' character, and the digits '0' to '9'. Label names cannot contain the space character.

Label names (once declared), become a keyword in CitectVBA. Like most keywords in CitectVBA, label names are not case sensitive. For example, all of the following label examples are treated identically in CitectVBA:

label1:
Label1:
LABEL1:

Note: Labels as used in CitectVBA are not the same as labels used in CitectSCADA.

See Also