Positron Compiler Documentation

Parameters

Positron16 · Revision 1.1.3.5 · PDF page 56

A procedure may have up to 10 parameters. Each parameter must be given a unique name and a variable type. The parameter name must consist of more than one character. The types supported as parameters are:

Bit, Byte, SByte, Word, SWord, Dword, SDword, Float, Double, and String.

A parameter can be passed by value or by reference. By value will copy the contents into the parameter variable, while by reference will copy the address of the original variable into the parameter variable. By default, a parameter is passed by value. In order to pass a parameter by reference, so that it can be accessed by one of the PtrX commands, the parameter name must be preceded by the text ByRef. For clarification, the text ByValue may precede a parameter name to illustrate that the variable is passed by value. For example:

Proc MyProc(ByRef pWordin as Word, ByValue pDwordin as Dword)
  HrsoutLn Dec pWordin, " : ", Dec pDwordin
EndProc

The syntax for creating parameters is the same as when they are created using Dim. String or Array variables must be given lengths. For example, to create a 10 character String parameter use:

Proc MyProc(pMyString as String * 10)

To create a 10 element unsigned Word array parameter, use:

Proc MyProc(pMyArray[10] as Word)
View original PDF page 56Open page in PDFOriginal PDF page 56