11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ON/GOSUB<br />

Syntax<br />

ON expr GOSUB label[:][, label[:]...]<br />

Description<br />

The <strong>UniBasic</strong> ON/GOSUB command transfers program control to a subroutine label<br />

based on the value of expr.<br />

ON GOSUB can appear on one line, or it can be spread over as many successive lines<br />

as necessary. Labels must be separated by commas.<br />

When the program encounters a RETURN statement in the called subroutine,<br />

UniData transfers control to the statement immediately following ON GOSUB. If the<br />

subroutine contains a RETURN TO label statement, control resumes at the label<br />

specified in the RETURN statement.<br />

Note: In BASICTYPE M or P, if expr is nonnumeric or less than 1, UniData bypasses<br />

the GOSUB clause and the next program statement executes.<br />

1-529 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!