Re: deleting variables

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 2 Mar 2007 10:07:18 -0700 (MST)

>In some scripts I have to delete many variables within DO loops. I found
>only one procedure that delete variables and I was thinking in make a
>procedure that delete a group of variables specified by a list. But, I'm
>not sure if I can access variables of the main program with a function
>and delete them. Is it possible?

I am sure there is an NCL "rule" that states
that variables not local to a function or
procedure can not be deleted within a called procedure/function.

In the past, I have asked for the "delete"
procedure to be expanded

      a =
      b =
      c =

      delete(a)
      delete(b)
      delete(c)
      
to
      delete(a, b, c)
      

I was told this was not possible. :-(

A delete that could operate on multiple variables
would lead to cleaner codes.

Note: variables locally created within procedures or functions
are automatically deleted by NCL. The user need not
explicitly delete them. This is a nice feature.

>
>By the way: in the NCL reference guide (online), in the part that talk
>about IF statement the syntax provided is:
>
>if(/scalar_logical_expression/) then
>
> / statement list /
>
>end if
>if(/ scalar_logical_expression/) then
>
> / statement list /
>
>else
>
> / statement list /
>
>end if
>
>Seeing carefully one of my scripts I verify that my IF statement hadn't
>the THEN word, but the scripts still works. So, is the reference manual
>wrong don't showing that THEN is optional? Or is there a malfunction in
>IF statement?
>_______________________________________________

A developer will have to answer this one.
I think the "then" is optional but
the "end if" is required to complete the "block"

fortran: if (s.eq.5) pi = 4*atan(1) ! no need for an "end if"

NCL: if (s.eq.5) then
             pi = ..
         end if
    also
         if (s.eq.5) pi = 4*atan(1)
         end if ; <=== required
         
         if (isvar("pi")) then ; just in case s.ne.5 :-)
             print(pi)
         end if

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 02 2007 - 10:07:18 MST

This archive was generated by hypermail 2.2.0 : Fri Mar 02 2007 - 17:25:16 MST