Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Designator: Declare a Private Method Block.

...

  • Name is the desired name for the private method.
  • Param is a parameter name (optional). Methods can contain zero or more comma-delimited parameters, enclosed in parentheses. Param must be globally unique, but other methods may also use the same symbol name. Each parameter is essentially a long variable and can be treated as such.
  • RValue is a name for the return value of the method (optional). This becomes an alias to the method's built-in RESULT variable. RValue must be globally unique, but other methods may also use the same symbol name. The RValue (and/or RESULT variable) is initialized to zero (0) upon each call to the method.
  • LocalVar is a name for a local variable (optional). LocalVar must be globally unique, but other methods may also use the same symbol name. All local variables are of size long (four bytes) and are left uninitialized upon each call to the method. Methods can contain zero or more comma-delimited local variables.
  • Count is an optional expression, enclosed in brackets, that indicates this is a local array variable, with Count number of elements; each being a long in size. When later referencing these elements, they begin with element 0 and end with element Count-1.
  • SourceCodeStatements is one or more lines of executable source code that perform the function of the method; usually indented by at least two spaces for readability.

Explanation

PRI is the Private Method Block declaration. A Private Method is a section of source code that performs a specific function then returns a result value. This is one of six special declarations (CON, VAR, OBJ, PUB, PRI, and DAT) that provide inherent structure to the Spin language.

...