Since  execution 
of 
the  program  shown  above  will  continue  indefinitely,  stop 
it 
by 
pressing  the I 
SH
I
FT 
I and  I BREAK  I keys  together (this  may be done at any 
time  to  stop  execution 
of 
a  BASIC  program). 
To 
resume  execution,  execute  the 
CONT  J  command. 
Note  The line 
number 
specified in a GOTO statement may 
not 
be 
that 
of a line included 
within a 
FOR 
.
.. 
NEXT loop. 
2. 3. 6. 3 
GOSUB 
~RETURN 
..
.
..
.
.........
. .
..
....
. .
.. 
(abbreviated format:  GOS. 
~ 
RET.) 
I  Format  I  GOSUB Ln 
Function 
Example 
RETURN 
Ln . . . Destination line 
number 
The 
GOSUB  statement  unconditionally  transfers  program  execution  to  a  BASIC 
subroutine  beginning  at  the  line 
number 
specified  in  Ln;  after execution 
of 
the 
subroutine has  been  completed,  execution 
is 
returned  to 
the 
statement following 
GOSUB when a RETURN statement 
is 
executed. 
GOSUB  ~ RETURN  statements  are  frequently  used  when  the  same processing 
is 
required at several  different points in  a program.  In such cases, a subroutine which 
performs  this  processing 
is 
included  at  some  point in the program,  and  execution 
is 
branched 
to 
this subroutine at appropriate points by means 
of 
the GOSUB state-
ment. 
After 
the  required  processing  has  been completed, execution is returned 
to 
the 
main routine 
by 
the RETURN statement. 
100 
X
=1
0 
1
10\GOS
UB 
l
_. 
1 2 0  P R I NT 
130 
E
ND 
2
00 
X= X
*2 
21
0 
RETURN 
200~ 
X 
------------------------------
--------
------
----
--
----------------------49