basic.return

Statement/BASIC Program, Releases: AP and R83

Returns control from a local or external subroutine.

Syntax

return return { to statement.label }

Description

terminates an internal or external subroutine and returns execution control to the statement following the invoking 'call' or 'gosub' statement.

The 'to' clause may only be used with an internal subroutine, and transfers control to the specified statement label. This is not considered a good programming practice.

Example

input answer
if answer = 'y' then gosub 1000
print 'back again'
stop
1000 * subroutine
print 'ok'
return

In this example, if the answer is 'y' then call internal subroutine
1000. When 1000 is complete, control is 'returned' to the line which
prints 'back again'.

See Also

Command Name Type Description
basic.gosub Statement Transfers control to local subroutine.
basic.on.gosub Statement Calculated gosub.
basic.call Statement Calls external Pick/BASIC subroutine.
basic.subroutine Statement Defines program as external subroutine.
basic.statement.labels Definition used as the destination of a 'goto' or 'gosub' statement.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.