S# also provides a possibility importing a set of global variables into the local scope of a function. This is achieved by means of global() statement used within function definition.
Example:
myVariable1 = 10;
myVariable2 = "hello";
function MyFunction() global (myVariable1, myVariable2)
{
myVariable1++;
myVariable2+= " world!";
Console.WriteLine(myVariable1);
Console.WriteLine(myVariable2);
}
The example above will provide the following output when executed:
11
hello world!
Please note that after variables from global scope are merged into the local one for "MyFunction" function it is not possible to declare local variables with the same names. It is recommended to use "global()" statement for functions which are intended to manipulate static (global) variables primarily.