Transferring procedure and function parameters
By default, method, procedure and function parameters are transferred using references, i.e. when you change formal parameter within a procedure or a function, actual parameter also changes. When a parameter is transferred through value, changes of formal parameter do not influence actual parameter of procedure call. Use Valkeyword to specify that a parameter has to be transferred by value.
If you specify a default value and if this parameter is the last in the list, you can omit it from the list of transferred actual parameters and do not put a comma before this parameter.
If a parameter doesn't have a default value, you can omit it in the list of actual parameters, but you should place a comma separator.
If you omit a parameter, it is either assigned a default value (if available) or Undefinedvalue.
If you do not transfer any parameters during method, procedure or function call (empty parameter list), you still have to use round brackets.
Example:
Var Glob;
// Function description
Function MyFunction(Val Par1, Par2, Par3) Export
Loc = Glob + Par1 + Par2 + Par3;
Par1 = 40;
Return Loc;
EndFunction;
// Procedure description
Procedure MyProcedure(Par1, Par2, Par3) Export
Loc = Glob + Par1 + Par2 + Par3;
Par1 = 40;
EndProcedure;
Glob = 100;
A = 10;
Res = MyFunction(A, 10, 10); // Function call
// Here Res = 130, and the variable A = 10, although in function body
// the Par1 value is changed to 40.
MyProcedure(A, 10, 10); // Procedure call
// Here the variable A = 40, because in the procedure body
// the Par1 value is changed to 40.