Declaring Constants
The declaration of a constant corresponds to the declaration of a read-only variable. Constants can be used exactly like variables, except that they cannot be modified.
Constants are declared using the following syntax:
Define {Identifier} for {Token}
Where:
- {Identifier} is the name assigned to the new constant.
- {Token} is the token that the named constant will represent. You cannot use a DataFlex reserved word to name a constant. The token that you use can be any String, Number, or Date token.
Examples of Constant Declarations
Define C_PI for 3.14156
Define C_MaxLines for 100
Define C_CompanyName for "Data Access Corporation"
DataFlex naming convention suggests that you prefix your constant names with a "C_". This will help you to distinguish constants from variable names within your program.