17.08.2013 Views

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

RETURN<br />

Chapter 2 Program Instructions<br />

Field of Application Statement for returning to the main program after having branched to<br />

a subroutine because of a GOSUB statement.<br />

Syntax RETURN[|]<br />

is optionally the number or label of a line in the main program<br />

to return to.<br />

Remarks When the statement RETURN is encountered during the execution of a<br />

subroutine, the execution will return to the main program. Execution will<br />

continue from the statement immediately following the most recently<br />

executed GOSUB or from an optionally specified line.<br />

If a RETURN statement is encountered without a GOSUB statement having<br />

been previously executed, an error condition will occur (Error 28 “Return<br />

without Gosub”).<br />

Example 10 PRINT "This is the main program"<br />

20 GOSUB 1000<br />

30 PRINT "You're back in the main program"<br />

40 END<br />

1000 PRINT "This is subroutine 1"<br />

1010 GOSUB 2000<br />

1020 PRINT "You're back in subroutine 1"<br />

1030 RETURN<br />

2000 PRINT "This is subroutine 2"<br />

2010 GOSUB 3000<br />

2020 PRINT "You're back in subroutine 2"<br />

2030 RETURN<br />

3000 PRINT "This is subroutine 3"<br />

3010 PRINT "You're leaving subroutine 3"<br />

3020 RETURN<br />

RUN<br />

yields:<br />

This is the main program<br />

This is subroutine 1<br />

This is subroutine 2<br />

This is subroutine 3<br />

You're leaving subroutine 3<br />

You're back in subroutine 2<br />

You're back in subroutine 1<br />

You're back in the main program<br />

<strong>Intermec</strong> Fingerprint 7.2 – Reference Manual Ed. 3 196

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

Saved successfully!

Ooh no, something went wrong!