PROC
A keyword used at the start of all user declared procedures. The first character of a procedure name can be an underline (or a number).
If there are spaces between the procedure name and the opening bracket of the parameter list (if any) they must be present both in the definition and the call. It’s safer not to have spaces between the procedure name and the opening bracket.
A procedure may be defined with any number of parameters of any type.
A procedure definition is terminated by ENDPROC.
A procedure does not have to be declared before it is called.
Procedures are re-entrant and the parameters (arguments) are passed by value.
10 INPUT"Number of discs "F
20 PROC_hanoi(F,1,2,3)
30 END
40 :
50 DEF PROC_hanoi(A,B,C,D)
60 IF A=0 THEN ENDPROC
70 PROC_hanoi(A-1,B,D,C)
80 PRINT"Move disk ";A" from ";B" to ";C
90 PROC_hanoi(A-1,D,C,B)
100 ENDPROCSee the ‘Procedures and Functions’ sub-section for more details.
Syntax
PROC<name>[(<exp>{,<exp>})]Associated Keywords
DEF, ENDPROC, LOCAL
Last updated on