scope
Identifies the variable scope (e.g. global, local).
Indirect parameter passing is disabled
1
No. | Type | Description |
---|---|---|
1 code |
variable :string |
Variable to check |
Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
string | variable form One of the following:
|
// In the main program area, variables created are global.
g[] = world;
define procedure ( foo )
{
// Inside procedure, functions and B4P programs called with start(...),
// the variables declared are local unless the 'global' function is used.
a[] = 1;
global { h[] = 1; }
g[me] = you;
echo( "Variable a[]: ", scope( a[] ) ); // global
echo( "Variable g[]: ", scope( g[] ) ); // local
echo( "Variable g[me]: ", scope( g[me] ) ); // global
echo( "Variable h[]: ", scope( h[] ) ); // global
echo( "Verbose settings: ", scope( runtime settings[verbose] ) ); // system
}
foo; // Call the function
Variable a[]: local
Variable g[]: global
Variable g[me]: global
Variable h[]: global
Verbose settings: system