PARAMETERS
Create private parameter variables
──────────────────────────────────────────────────────────────────────────────

Syntax

PARAMETERS <idParam> AS|ASREF <idType>, ...

Arguments

<idParam> is the declaration of one or more parameter variables.
Variables specified in this list are declared local.

AS|ASREF indicates whether the parameter is expected to be normal or
passed by reference. AS specifies a normal parameter and ASREF
specifies a parameter that is expected to be passed by reference. If
you specify AS, and the parameter is passed by reference, then no error
will be given, as program behaviour is not effected.

<idType> is the type of the parameter/return value. For the
FUNCTION or PROCEDURE statement, this is called every time the function
or procedure is called, and for a FUNCTION RETURN statement it is called
just before the return is executed.


Description

This allows you to define checking for parameters that are passed down
to a procedure or function and received using the PARAMETERS statement
For example, if you define a procedure as:

PROCEDURE Foo
PARAMETERS nNumber1 AS INT, nNumber2 AS INT
RETURN

And you call this procedure with:

Foo(1, 1.1)

The MrDebug will pop up with the following message in the Assert/Trace
window:

Param 2 is not type INT

And the program will stop at that point for your inspection. So you can
take a look at the calling routine to see what has caused the problem.

Notes

The allowable types for <idType> are:

CHARACTER A character string
STRING A character string (Same as CHARACTER)
NUMERIC A number of any specification
INTEGER A numeric integer (no decimal places)
INT A numeric integer (no decimal places)
FLOAT A floating pointer number
LOGICAL A logical value
DATE A date value
BLOCK A code block
CODEBLOCK A code block
ARRAY An array of any length
OBJECT An object of any class
ANY Any data type
USUAL Any data type (Same as ANY)

Example

This example shows a function declaration with the second
parameter passed by reference.

PROCEDURE Message
PARAMETERS nCounter AS INT, cPrompt AS REF

nCounter ++
? cPrompt

RETURN


Files: Header file is MrDebug.CH