delete(var) and try-catch

From: Lunde, Bruce N CIV NAVOCEANO, NP1 <bruce.lunde_at_nyahnyahspammersnyahnyah>
Date: Tue, 21 Aug 2007 16:01:09 -0500

Hello,

Is there any way to turn the following into
a procedure ?

if( isvar("foo") )then
  delete(foo)
end if

Related to this, is there any way to perform
a "try-catch" statement in order to try executing
a statement and catching any errors so that the
script does not exit on a failure ? For example,

begin
  print(1)
  delete(myvar)
  print(2)
end

will never get to "print(2)" if "myvar" does
not exist (using delete() as an example of
something that could fail).

Something like

try:
  delete(myvar)
catch IERR:
  print("no myvar, error code "+IERR)
endtry

Thanks, Bruce

=====
Bruce Lunde
Bruce.Lunde_at_navy.mil
228-688-5843
Code NP1
Naval Oceanographic Office
Stennis Space Center, MS
=====
 
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 21 2007 - 15:01:09 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 23 2007 - 15:57:17 MDT