DIM_LOCAL

DIM_LOCAL V

DEFINES ONE OR SEVERAL VARIABLES INSIDE A SUBROUTINE OR FUNCTION

  • Type: Command
  • Parameters: n
  • Group: Reference

ACTION

The command defines one or several variables, simple or in array.

A variable name can contain letters, the character underscore ("_") or numbers, but the first character must be a letter.

A variable can be one out the 3 types : integer, real, string.

The type of a variable is defined by the last character of its name :

% for an integer variable

$ for a string variable

neither % nor $ for a real variable

An array is defined with its maximal number of elements.

SYNTAX: DIM_LOCAL V1[,Vn]

  • V1, V2, ... Vn : Variable names

USE

  • The statement DIM_LOCAL is used to define a variable used locally in a subroutine or in a function.

ERROR

  • If the variable name contains symbols other than letters, character underscore or numbers.
  • If the variable is already defined.

EXAMPLE

dim a%(20),i%

for i%=1 to 10:a%(i%)=i%:next i%

for i%=1 to 10

to_printer(a%(i%))

next i%

end

sub to_printer(j%)

dim_local a%(20),i%

for i%=1 to 10:a%(i%)=100:next i%

print j%

end_sub

SEE ALSO

ADR()

DIM

FREE