global
global { statements; }
global () statement;
global () { statements; }
"ex In the statement or code block following the global function, all new variables defined are global variables. This ruling does not apply if a user function is called with that designated statement or code block, i.e. new variables created in the called user-defined functions are local functions. This ruling preents unexpected effects inside these user functions. The global variables are obviously retained if this function is called out from other user defined functions or program files.
Indirect parameter passing is disabled
0
d[] = 10; // Global variable defined outside the function
define procedure ( foo )
{
a[] = 1;
global
{
b[] = 2;
a[c] = 3; // This one stays a local variable
delete( d[] ); // If not in the global block, then exception happens.
}
echo( "Scope of b[] : ", scope( b[] ) ); // globa
echo( "Scope of a[] : ", scope( a[] ) ); // local
echo( "Scope of a[c]: ", scope( a[c]) ); // local
echo( "Scope of d[] : ", scope( d[] ) ); // Not found.
}
foo;
echo( "Global variable b[] = ", b[] );
Scope of b[] : global
Scope of a[] : local
Scope of a[c]: local
Scope of d[] : not found
Global variable b[] = 2