Goto main content

global

Declare a global variable in a function or include.

GLOBAL

NAME

global - Declares a global variable in a function

SYNOPSIS

global id[, id1]*;

DESCRIPTION

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.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

         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 0",file:"/tmp/tib.sn");
        compile(src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
        c=12;
        include("/tmp/tib.snc");
        c;
        }}. return res=test 6060.

SEE ALSO

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.