Condividi tramite


Variable Declaration

When you store a value to a variable and the variable does not exist, Visual FoxPro implicitly declares it with PRIVATE scope. Other languages that require explicit declaration of variables return an error. To create variables in Visual FoxPro with PUBLIC or LOCAL scope, you must explicitly declare them with the PUBLIC or LOCAL command.

In Visual FoxPro, you do not assign a data type to a variable (although it is recommended that you name your variable with a prefix suggesting the data type you will use it for). Other languages require that you assign a data type to a variable when you declare it.

Visual FoxPro BASIC
Variables are implicitly declared; no data typing. Variables can be implicitly declared; variable name dictates data type.
Pascal C/C++
Variables must be explicitly declared and assigned a data type. Variables must be explicitly declared and assigned a data type.

See Also

Assignment Statements | Case Sensitivity | CASE Statements | Comments | FOR Loops | IF Statements | LanguageOptions Property | Parameter Passing by Reference | Parameter Passing by Value | WHILE Loops