Share via


Variable Naming Conventions

When naming variables, use the following recommended format.

[Scope]TypeVariableName

Parameters

  • [ Scope]
    Specifies a character that indicates the range of reference for the variable.

    The following table lists suggested values for Scope.

    Scope

    Description

    l

    Local

    t

    Parameter

    g

    Public (Global)

    p

    Private (Default)

    Note

    In some cases, explicit scoping does not apply. For example, in the main program of a standalone application, there is no difference in visibility for variables scoped as PUBLIC or PRIVATE. In sample programs, the type prefix is always relevant and required.

  • Type
    Specifies a character that indicates the data type of the variable.

    The following table lists suggested values for Type.

    Type

    Description

    a

    Array

    c

    Character, Varchar, Varchar (Binary)

    y

    Currency

    d

    Date

    t

    DateTime

    b

    Double

    f

    Float

    l

    Logical

    n

    Numeric

    o

    Object

    q

    Varbinary, Blob

    u

    Unknown

  • VariableName
    Specifies the name of the variable.

Example

The following example illustrates how the letter "n" indicates that the Counter variable has Numeric type and local scope:

nCounter
lnCounter

See Also

Concepts

Creating Visual FoxPro Names

Reference

Constant Naming Conventions

Object Naming Conventions

Table Field Naming Conventions

Window Naming Conventions

Other Resources

Naming Conventions