SET UDFPARMS Command

Example   See Also

Specifies if Microsoft Visual FoxPro passes parameters to a user-defined function (UDF) by value or by reference.

Syntax

SET UDFPARMS TO VALUE | REFERENCE

Arguments

TO VALUE

Specifies that a variable be passed to a user-defined function by value. When a variable is passed by value, the variable's value can be changed in the user-defined function, but the variable's original value in the calling program isn't changed.

TO REFERENCE

Specifies that a variable be passed to a user-defined function by reference. When a variable is passed by reference and the user-defined function changes the value of the passed variable, the variable's original value in the calling program is also changed.

Remarks

By default, variables are passed to a user-defined function by value. (Variables passed to procedures with DO ... WITH are passed by reference.)

You can force parameters to be passed to a UDF by value or reference, regardless of the setting of SET UDFPARMS. Enclose a variable in parentheses to force the variable to be passed by value. Preface the variable with an @ symbol to force the variable to be passed by reference.

Tip   Entire arrays can be passed to a procedure or user-defined function. The entire array is passed if you issue SET UDFPARMS TO REFERENCE or preface the array name with @. The first element of the array is passed by value if you issue SET UDFPARMS TO VALUE or enclose the array name by parentheses. Array elements are always passed by value.