Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Follow this suggested format for naming variables.
[Scope]TypeName
Parameters
- Scope
Optional. A convention for noting the range of reference for the variable. For example, local variables can be prefixed with "l," which reminds you that they can be referenced only within the procedure they were defined in. Suggested expressions for Scope are as follows.Scope Description Example l Local lnCounterp Private (default) pnStatusg Public (global) gnOldRecnot Parameter tnRecNo - Type
Convention for noting the data type of a variable. Suggested prefixes for Type are as follows.Type Description Example a Array aMonthsc Character cLastNamey Currency yCurrentValued Date dBirthDayt Datetime tLastModifiedb Double bValuef Float fInterestl Logical lFlagn Numeric nCountero Object oEmployeeu Unknown uReturnValue
Remarks
Prefixes aren't required, but are recommended as good programming practice. Using a prefix does not dictate the value of a variable — in Visual FoxPro prefixes are used only as a naming convention. For example, adding the prefix "c" does not check that only character data is stored to the variable, but it does help you remember that the variable was created to accept character data.
Note The scope prefix is recommended but not required. In some cases, explicit scoping does not apply. For example, in the main program of a stand-alone application there is no difference in visibility for variables scoped as PUBLIC or PRIVATE. The type prefix is always relevant and is required in sample programs.
For more information, see Visual FoxPro Naming Rules.
See Also
Constant Naming Conventions | Object Naming Conventions | Table Field Naming Conventions | Visual FoxPro Naming Rules | Window Naming Conventions