11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GOTO<br />

Syntax<br />

GOTO label [:]<br />

Synonym<br />

GO<br />

Description<br />

The <strong>UniBasic</strong> GOTO command branches unconditionally to a statement label within<br />

a program or subroutine. A statement label must exist in the program or subroutine.<br />

If the label you specify does not exist, the compiler generates an error message and<br />

the program aborts. After a program executes a GOTO, it does not keep track of the<br />

point of departure, but simply moves to the new statement and begins executing<br />

there.<br />

You cannot use the <strong>UniBasic</strong> RETURN command in conjunction with a GOTO<br />

statement.<br />

Tip: Use GOSUB instead of GOTO to make your programs easier to follow and<br />

maintain.<br />

Examples<br />

In the following example, the program statement transfers program control to the<br />

statement label 2510:<br />

GOTO 2510<br />

In the next example, the program statement transfers control to the statement label<br />

START if the variable RETRY is true:<br />

IF RETRY GOTO START<br />

1-317

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!