Procedures
A procedure is essentially a special subroutine in a wrapper that can be optionally passed parameter variables and optionally return a variable. The code within the procedure block is self contained, including local variables, symbols and labels who’s names are local to the procedure's block and cannot be accessed by the main program or another procedure, even though the names may be the same within different procedures.
The Positron8 compiler has a procedure mechanism that allows procedures to be constructed along with their local variables and, moreover, the procedure will not be included into the program unless it is called by the main program or from within another procedure. A procedure also has the ability to return a variable for use within an expression or comparison etc. This means that libraries of procedures can be created and only the ones called will actually be used. When the called procedures are created within a program, they will reside above the main program, so they will not be in the way of the main listing.
A procedure is created by the keyword Proc and ended by the keyword EndProc
A simple procedure block is shown below:
Proc MyProc(pBytein as Byte)
HRsoutLn Dec pBytein
EndProc
To call the above procedure, give its name and any associated parameters:
MyProc(123)
