Global variable

Boyin Huang Boyin.Huang at NOAA.GOV
Wed Jun 8 09:56:48 EDT 2005


I failed to define a global variable in Grads 1.85SL11.

Here is the main script
rc = gsfallow("on")
_mc1='i love you'
_mc2='you love me'
'fn.gs '
say _mc1
say _mc2

Here is the sub-script "fn.gs" at the same directory
say _mc1
say _mc2
_mc1='aa'
_mc2='bb'

Here is the output
_mc1
_mc2
i love you
you love me

Obviously, _mc1 and _mc2 defined in the main script have not passed into the
subscript, and those redefined in the subscript have not passed into the
main script either.

What is the problem?

Kilian Hagemann wrote:

>Boyin,
>
>Check out how to dynamically load script functions, it might solve your
>problem:
>
>http://grads.iges.org/grads/gadoc/gsf.html
>
>--
>Kilian Hagemann
>
>Climate Systems Analysis Group
>University of Cape Town
>Republic of South Africa
>Tel(w): ++27 21 650 2748
>
>
>

--
Boyin Huang, Oceanographer
RSIS/NOAA CPC
Room 605-A, WWB
5200 Auth Rd
Camp Springs, MD 20746
Phone: 301-763-8000 ext 7575
Fax: 301-763-8395
Email: boyin.huang at noaa.gov



More information about the gradsusr mailing list