basic.return
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
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
