Local

This keyword is used as a prefix to declare local variables. Local variables have a duration and visibility scope limited to a Call, fmet, and func call.

A local variable is created in the [L] class. Once created, it will persist until the End instruction is encountered, or if it is destroyed by the use of the Kill instruction. The local variables are shared with code that is called by a Gosub instruction.

Syntax

Local DECLARATION1 VARIABLE(DIMENSIONS)
Local DECLARATION2 VARIABLE(SIZE)(DIMENSIONS)
Local Instance VARIABLE Using CLASS
Local Instance VARIABLE(DIMENSIONS) Using CLASS
Default Local
  • DECLARATION1 may be one of the following keywords: Tinyint, Libelle, Date, Float, Double, Decimal, Datetime, or Uuident.
  • DECLARATION2 may be one of the following keywords: Char, Schar, Clbfile, or Blbfile.
  • SIZE is a numeric value.
  • DIMENSIONS can be:
    • A single numeric value DIM, meaning that we have an array with an index range from 0 to DIM-1.
    • A range of numeric values INDEX1..INDEX2, where the index varies between INDEX1 and INDEX2.
    • Several indexes or index ranges separated by a comma. For multiple dimension arrays, up to 4 dimensions are possible.
  • CLASS is a class code, which refers to the class or representation dictionary.

Default Local is a declaration that sets up the fact that a declaration without Global or Local Keyword will be considered as global. This type of syntax should also be avoided because it makes ambiguous the scope of the created variable.

Examples

Local Char TEMPORARY_STRING(100)
Local Instance MYORDER Using C_ORDER
Local TinyInt BYTES_BUFFER(1..1024)

See also

Global, Variable, Value, Const, Tinyint, Libelle, Date, Shortint, Integer, Float, Double, Decimal, Char, Schar, Clbfile, Blbfile, Uuident, Datetime, Instance.