Copyright 2008 Shoptalk Systems
GLOBAL var1[, var2...]
This statement specifies that the variables listed are global in scope. They
are visible inside FUNCTIONS and SUBs as well as in the main program code.
Global variables can be modified inside functions and subroutines as well, so
care must be taken not to alter them accidentally, because this can easily cause
errors in the program that are difficult to isolate. Use global variables for
things like values for true and false, file paths, user preferences etc.
Special automatic global status is given to certain default variables used for sizing, positioning, and coloring windows and controls. These include variables DefaultDir$, Platform$, UserInfo$, UrlKeys$, UserAddress$, ProjectsRoot$, ResourcesRoot$, Err$, Err, EventKey$, RowIndex. The value of these variables can be seen and modified in any subroutine/function.
global true, font$, #dir
true = 1
font$ = "times_new_roman 10"
files #dir, "*"
print "true = "; true
print "font$ = "; font$
print "#dir = "; #dir debug$()
See also: FUNCTION, SUB