MC-Basic:GOTO

From SoftMC-Wiki
Revision as of 16:00, 13 December 2010 by Arwiebe (talk | contribs) (Created page with '{{MC-Basic |SHORT FORM= |SYNTAX= GOTO ''<program label><br> <br> <program lable>:'' |AVAILABILITY= All versions |DESCRIPTION= The GOTO statement is used to perform an uncon…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The GOTO statement is used to perform an unconditional branch to another section of code. It references a label that must appear in the code. Labels are written as a name followed by a colon. Labels must appear on their own lines and they may be commented. You can only branch within a program, event, function, or subroutine. The GOTO statement and the label must be within the same program block. The GOTO statement can be compared to the conditional branching statements, IF..THEN and SELECT CASE.

Syntax

GOTO <program label>

<program lable>:

Availability

All versions

Scope

Task

Limitations

Write-Only. The label must appear on a line of its own. Labels may not be repeated within a task. A GOTO branch must reference a label within the same program block (PROGRAM…END PROGRAM, SUB…END SUB,

FUNCTION…END FUNCTION, and ONEVENT…END ONEVENT).

Examples

Program
       <code>
       GOTO Reference1
       <code>

Reference1:
       <code to be executed after GOTO>

End Program

See Also