Partager via


Macro Substitution (Visual FoxPro)

You can replace names with variables by using macro substitution. To use macro substitution, place an ampersand (&) before the variable to tell Visual FoxPro to use the value of the variable as a name, and use a period (.) to end the macro substitution expression.

For example, the following print statement produces "FoxPro":

x = "Fox"
? "&x.Pro"

A command or function containing a name expression runs faster than one containing macro substitution, so use a name expression instead of macro substitution whenever possible. For more information about macro substitution, see the & Command topic in Help.

See Also

Concepts

Creating Visual FoxPro Names

Name Expression Creation

Other Resources

Building Expressions