< Futurebasic < Language < Reference

GOTO

Syntax

GOTO {lineNumber|"statementLabel"

Description

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

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

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.