Global


Syntax
Global <variable> [= <expression>], <variable> [= <expression>], ...]
Description
Global allows the variables to be used as global, ie: they can be accessed inside a Procedure. In this case the command Global for the according variables must be called before the declaration of the procedure. Each variable can have a default value directly assigned to it. Global can also be used with arrays and linkedlists.

To use local variables in a procedure, which have the same name as global variables, look at the Protected and Static keywords.

Example: With variables

  Global a.l, b.b, c, d = 20
  
  Procedure Change()
    Debug a  ; Will be 10 as the variable is global
  EndProcedure
  
  a = 10
  Change()

Example: With array

  Global Dim Array(2)
  
  Procedure Change()
    Debug Array(0)  ; Will be 10 as the array is global
  EndProcedure
  
  Array(0) = 10
  Change()