Global and local variables
Global variables
Only array and unsigned variables must be declared at the first beginning of the source script ; so, they are always global for this script.
Variables other than array or unsigned have not to be declared and they follow the following rules:
any variable which identifier (maximum 32 characters) ends with character $ is a string variable (maximum size: 32 Koctets) ;
any variable which identifier does not end with character $ is a signed integer variable (coded on 32 bytes so between -2147483648 and +2147483647).
Those variables are global variables.
Local variables
Within a procedure or a function, local variables can be defined ; those local variables exist only during execution of the procedure or function.
A local variable must be defined before any statement within the procedure or function, by the use of keyword LOCAL. Variable type is implicit depending what character is at the end ot its identifier: if character $ ends its identifier, it's a string local variable, if not, it's an integer. A local integer variable is initialized to 0 by default, a local string variable is initialized to an empty string by default (string "").
For instance :
Function my_function()
Local numer, string$
...
...
Endfunction
32 local variables maximum can be defined in a procedure or function.
See also