www.delorie.com/gnu/docs/octave/Octave-FAQ_10.html   search  
 
Buy GNU books!


Frequently asked questions about Octave (with answers)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6 Unwind-protect

Octave supports a limited form of exception handling modelled after the unwind-protect form of Lisp. The general form of an unwind_protect block looks like this:

 
unwind_protect
  body
unwind_protect_cleanup
  cleanup
end_unwind_protect

Where body and cleanup are both optional and may contain any Octave expressions or commands. The statements in cleanup are guaranteed to be executed regardless of how control exits body.

The unwind_protect statement is often used to reliably restore the values of global variables that need to be temporarily changed.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003