300 PROC procedure Purpose This is used as the first part of a name to indicate that it refers to a procedure. See the keyword DEF for a fuller description. Example 10 DEF PROChello(X) 20 LOCAL Z 30 FOR Z=0 TO X 40 PRINT "Hello - how about this for BASIC!" 50 NEXT Z 60 ENDPROC Description A reserved word used at the start of all user declared procedures. There must not be a space between PROC and the rest of the procedure name.
Syntax DEF PROC [( | {, var> | } ] PROC [( | {, | var> } ] Associated keywords DEF , ENDPROC , LOCAL Demonstration program 10 REM Tower of Hanoi problem 20 INPUT "Number of disks",F 30 PROChanoi(F,1,2,3) 40 END 50 DEF PROChanoi(A,B,C,D) IF A=0 ENDPROC 60 PROChanoi(A-1,B,D,C) 70 PRINT "Move disk ";A; " from pile ";B; " to pile " ;C 80 PROChanoi (A-1,D,C,B) 90 ENDPROC