Procedures
A procedure is essentially a 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 Positron16 compiler has a rudimentary 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.
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 use the above procedure, give its name and any associated parameters:
MyProc(123)