17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

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.

GW-BASIC <strong>User's</strong> Guide<br />

RETURN Statement<br />

Purpose:<br />

To return from a subroutine.<br />

Syntax:<br />

RETURN [line number]<br />

Comments:<br />

The RETURN statement causes GW-BASIC to branch back to the statement following the most<br />

recent GOSUB statement. A subroutine may contain more than one RETURN statement to return<br />

from different points in the subroutine. Subroutines may appear anywhere in the program.<br />

RETURN line number is primarily intended for use with event trapping. It sends the eventtrapping<br />

routine back into the GW-BASIC program at a fixed line number while still eliminating<br />

the GOSUB entry that the trap created.<br />

When a trap is made for a particular event, the trap automatically causes a STOP on that event so<br />

that recursive traps can never take place. The RETURN from the trap routine automatically does an<br />

ON unless an explicit OFF has been performed inside the trap routine.<br />

The non-local RETURN must be used with care. Any GOSUB, WHILE, or FOR statement active at<br />

the time of the trap remains active.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/RETURN.html28/03/2004 21.29.45

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

Saved successfully!

Ooh no, something went wrong!