global - Declares a global variable in a function
global id[, id1]*;
This statement is used to declare a global variable inside a function.
The variable must also be defined global in the parent before it is used.
Note: In the followings examples, the _ between the { should be removed to make it work.
res={_{
global a,b
a=5;
function f()
global a,g;
'a='; a;
a=6;
g=a;
endfunction
'a='; a;
f();
'a=';a;
'g='; g;
}}.
return res=a=5a=5a=6g=6.
res={_{
remove("/tmp/tib.sn");
write(data:"test {{ global c; a = 5; c = a * c; c; }}",file:"/tmp/tib.sn");
compile(src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
c=12;
include("/tmp/tib.snc");
c;
}}. return res=test 6060.
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com