FOR I-l TO 5 STEPl
F O R J = 2 T O 2 0 S T E P 2
5
NEXT I
NEXT J
This kind of FOR'NEXT loop
cannot be assembled.
Furthermore, exit from FOR'NEXT loop is permitted but entry to FOR'NEXT loop is
not permitted.
FOR A =
FOR B
THEN-
NEXT B
NEXT A
5-6-6 Subroutine Command
• G O S U B s t a t e m e n t
A subroutine is also called a subprogram . It is different from programs shown so far
(called "main routines"). It is a separate program to be called out from a main routine.
The command to call out this subroutine is a GOSUB statement. Using this command,
program execution jumps from the main routine to the subroutine and after executing
the program in the subroutine, jumps back to the original location in the main routine
» using the RETURN statement in the subroutine.
Format: GOSUB / ""-"encal expression
ff numerical expression subroutine callout (jump) command
RETURN command to return to main routine
-51 -