Global variables can be accessed from all other modules that import the exporting modules.
Note, however, that a
program can not be imported.
program globalVariableDemo(input, output, stdErr); var x: integer; procedure doMagic; begin // here, x is global to doMagic end; procedure foo; var // shadow the global x x: integer; begin // here, x is local, // as the top-scope x can not be accessed end; // MAIN // begin // here, x is local end.
If speed matters, global variables are/were used for frequently invoked routines, since allocating local variables on the stack takes time. This, however, is considered bad style. Nest your variables as deep as possible, but as high as necessary.
resourceString variable is always global.