Definition of Parameters
- Updated2025-10-31
- 2 minute(s) read
Definition of Parameters
Function parameters can be used in PAscript all global data types, including pabasic and fields.
No Parameters
If the function has no parameters it is defined as follows:
function [definition of return values] = function name() // implementation code endfunction
Example

One or Multiple Parameters
If the function has one or more parameters it is defined as follows:
function [definition of return values] =
function name (type parameter1, ..., type parameter_n)
// implementation code
endfunction
Example

Parameter Transfer and the ref Keyword
PAscript function parameters are transferred with Call-by-Value, which means that the value of the variable is copied and all changes to the parameter within the function have no effect on the variable (used as a parameter) outside of the function. However, sometimes a change to the variable is desirable. PAscript has defined the keyword ref for this purpose.
A parameter marked with ref can be changed within a function and the change will still be visible after the function has been executed.
Example

- ref can be used with text data types and with fields and value tables.
- Parameters that are not identified with ref can only be read within the function.
- If the keyword ref is used in the function definition, it must also be specified in the actual function call. If the keyword for the function call is missing a compiler error is generated.