Passing Data to Parameters

You can pass data, such as variables and array elements, as "arguments" to parameters by reference or by value. Passing data by reference saves changes made to data and passes those changes back to the calling program. Passing data by value passes a copy of the data for processing, leaving the original data intact.

By default, data passes to procedures by reference and to user-defined functions (UDFs) by value. However, you can change the default protocols for passing data through parameters, although Visual FoxPro always passes objects by reference.

Note

When passing entire arrays to parameters, you must pass them by reference. If you do not pass arrays by reference, only the first element is passed. Therefore, individual array elements are always passed by value.

See Also

Tasks

How to: Pass Data to Parameters by Reference

How to: Pass Data to Parameters by Value

Concepts

Parameters in Procedures and Functions

Other Resources

Programming in Visual FoxPro