BEGINS THE SUBROUTINE T
ACTION
The command SUB begins the subroutine called T.
A subroutine is a group of statements which must be processed a certain number of times.
There are two ways to declare a subroutine:
- a subroutine begins by a LABEL L and ends with RETURN. In The case, the subroutine is called by the command GOSUB L. When the keyword RETURN is executed, the execution of the main program resumes to the command immediately after the command GOSUB L. Remark: the name L must be defined by the keyword LABEL.
- a subroutine begins by SUB, followed by its name T and optionnally followed by parameters into parenthesis. In The case, the subroutine is called by its name, followed by parameters in brackets. When END_SUB or EXIT_SUB is executed, the execution resumes just after the subroutine call.
SYNTAX:
SUB Name(P1, P2 ,…)
USE ERROR EXAMPLE
dim i%
for i%=1 to 10
to_printer(i%)
next i%
end
sub to_printer(j%)
print j%
end_sub
SUB
SUB T
SEE ALSO
END_SUB
EXIT_SUB