Chapter
10
I
BASIC
Keywords
RETURN
Statement
RETURN
[Line]
Returns control to the line immediately following the most re-
cently executed GOSUB.
Line
tells BASIC to return to a specific line in the program. If
you omit
line,
BASIC goes to the line immediately following the
GOSUB.
Use caution when specifying
a
line number with RETURN. Any
other GOSUB, WHILE, or FOR statement remains active while
a
GOSUB subroutine
is
executing. If BASIC returns to
a
line
number that is outside these loops, an error occurs because the
loops were left incomplete.
If
the program encounters
a
RETURN statement without execu-
tion of a matching GOSUB, an error occurs.
Example
RETURN 40
returns from the subroutine to Line
40
in the program.
Sample Program
330 PRINT "THIS PROGRAM FINDS THE AREA OF
A
CIRCLE"
340 INPUT "TYPE IN
FI
VALUE FOR THE RADIUS";
R
350 GOSUB 370
360 PRINT "AREA IS"
;
A:
END
370
A
=
3.14
R
*
R
380 RETURN
294