Difference Between EVALUATE() and Macro Substitution

ID: Q96294

The information in this article applies to:

The EVALUATE() function and macro substitution (&) are used to place the value of a variable in a FoxPro command. Both methods enable the variable being used to be evaluated during execution time. The main difference between these methods is that the FoxPro compiler compiles the EVALUATE() term before execution.

In both methods, the value of the variable being referenced can change during execution. The FoxPro compiler interprets macro substitution as a reference to a variable that will not be resolved until the program is executed. In the case of the EVALUATE() function, the FoxPro compiler compiles the EVALUATE() call because it assumes the variable will be correctly assigned the value during execution.

Because it is compiled, the EVALUATE() function method executes faster than the macro-substitution method.

Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a evaluate speed performance KBCategory: kbprg KBSubcategory: FxprgMacrosub

Last Reviewed: June 27, 1995