scope of a variable

From: Takeshi Enomoto (eno AT XXXXXX)
Date: Mon Sep 13 2004 - 04:18:20 MDT


Dear all,

According to the NCL manual,
"the function may find that variable name
outside of the scope of the function or procedure"

In the following I expect "myfunc" to find variable a
in the calling script.
In fact a is not found.

Am I misunderstanding the manual?

$ cat func.ncl
undef("myfunc")

function myfunc(x)
begin
         return a*x
end

$ cat main.ncl
load "./func.ncl"

begin
         a = 5.
         print(myfunc(3.))
end

$ ncl main.ncl
  Copyright (C) 1995-2004 - All Rights Reserved
  University Corporation for Atmospheric Research
  NCAR Command Language Version 4.2.0.a031
  The use of this software is governed by a License Agreement.
  See http://ngwww.ucar.edu/ncl/ for more details.
fatal:Variable (a) is undefined

_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Mon Sep 13 2004 - 07:24:21 MDT