Futurebasic/Language/Reference/goto

From Wikibooks, open books for an open world
Jump to navigation Jump to search

GOTO[edit | edit source]

Syntax[edit | edit source]

GOTO {lineNumber|"statementLabel"

Description[edit | edit source]

Causes program execution to continue at the statement at the indicated line number or statement label. The target statement must be within the same "scope" as the GOTOstatement (i.e., they must both be within the "main" part of the program, or they must both be within the same local function). Also, you should never use GOTO to jump into the middle of any "block" statement structures (such as FOR...NEXT, SELECT...END SELECT, LONG IF...END IF, etc.).

GOTO is sometimes useful in the "main" part of the program, to branch around certain structures such as ENTERPROC procedures. However, excessive use of GOTO can lead to code that is difficult to read and maintain. The use of GOTO is generally discouraged; FutureBasic's other branching and looping structures offer a better solution.

See Also[edit | edit source]

LOCAL FN; GOSUB; FOR; LONG IF; SELECT; ENTERPROC