Skip to content

Local Command

Obsolete

Variables declared inside a procedure or function are automatically assumed to be local. See the declaring variables section in the Language Guide for more information.

Purpose

To define local variables for procedures and functions.

Syntax

local
type name [...name]
  • name: The name(s) of the local variables.
  • type: The declaration command for the data type of the variable(s) being declared.

What It Does

Local variables may be declared in any procedure or function. When declared with the local keyword, such variables' names may be duplicated in other functions and procedures, facilitating internal consistency among procedures and functions that do similar things. References to local variables from outside the procedure or function in which they were defined are invalid.

Variables declared without the local keyword are said to be "global" variables. Their names may not be duplicated anywhere else in the program, not even by local variables.

The type may be any type (String, Number, Date, Integer, or Real) except Indicator, and several variables of the same type may be listed on the same command line. Declarations of local Strings do not have a length parameter. Local strings grow dynamically on demand, unlike global strings, which are of static length.

Local symbols may be used just as any other variable in DataFlex. They can be used as arguments to any of the DataFlex commands. The only difference is that they are destroyed when the procedure or function is terminated.

Notes

  • Variables may not be declared as local outside functions and procedures, regardless of whether use ui is executed.