Share via


How to: Define a Constant

A constant can contain any data type value.

To assign a value to a constant

  • Use the #DEFINE preprocessor directive.

In the following example, the constant TABLERR1 is defined as a character string.

#DEFINE TABLERR1 "This table is not available. Please try later."

In an application, wherever you would normally specify the character string "This table is not available. Please try later." you can use TABLERR1 instead.

To release a defined constant

  • Use the #UNDEFINE preprocessor directive.

    #UNDEF TABLERR1
    

See Also

Reference

Variables (Visual FoxPro)

#DEFINE ... #UNDEF Preprocessor Directive

PI( ) Function

Constant is already created with #DEFINE (Error 1725)

#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive

Data Storage Containers