Arbortext Command Language > Commands > global
  
global
globalvar1 [, var2 …]
The global statement (command) declares one or more scalar or array global variables in the current package. It has the same syntax as the local statement. A scalar variable can be given an initial value by assignment using the form var = expr; see the examples that follow. If no initial value is given, the variable is initialized to null.
An array is declared by appending "[]" to the variable name. In this case the array can be a normal or an associative array, depending on context and will grow as necessary. A fixed size normal (that is, non-associative) array may be declared by specifying the size of the array inside the brackets, for example, arr[10]. The size may be an expression, which is evaluated at run time. The size is also the upper bound of the array since the first subscript is 1. To declare a fixed size array with a different minimum subscript, use the form
global arr[lb..hb]
where lb and hb are expressions giving the low and high bounds of the array. Arbortext Editor will signal a run-time error if you attempt to access elements outside the bounds of a fixed-size array.
* 
global is an executable statement. Each time it is encountered it will reinitialize the global variable.
Examples
global doc_name
global win = -1, doclist[]
global n1 = -5, n2 = n1 + 10
global arr[n1..n2]
Related Topics
Arrays and variables
local command