<html lang="en"> <head> <title>Quitting Octave - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Getting-Started.html#Getting-Started" title="Getting Started"> <link rel="prev" href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" title="Invoking Octave from the Command Line"> <link rel="next" href="Getting-Help.html#Getting-Help" title="Getting Help"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Quitting-Octave"></a> <p> Next: <a rel="next" accesskey="n" href="Getting-Help.html#Getting-Help">Getting Help</a>, Previous: <a rel="previous" accesskey="p" href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line">Invoking Octave from the Command Line</a>, Up: <a rel="up" accesskey="u" href="Getting-Started.html#Getting-Started">Getting Started</a> <hr> </div> <h3 class="section">2.2 Quitting Octave</h3> <p><a name="index-exiting-octave-77"></a><a name="index-quitting-octave-78"></a> <!-- toplev.cc --> <a name="doc_002dquit"></a> <div class="defun"> — Built-in Function: <b>exit</b> (<var>status</var>)<var><a name="index-exit-79"></a></var><br> — Built-in Function: <b>quit</b> (<var>status</var>)<var><a name="index-quit-80"></a></var><br> <blockquote><p>Exit the current Octave session. If the optional integer value <var>status</var> is supplied, pass that value to the operating system as the Octave's exit status. The default value is zero. </p></blockquote></div> <!-- toplev.cc --> <p><a name="doc_002datexit"></a> <div class="defun"> — Built-in Function: <b>atexit</b> (<var>fcn</var>)<var><a name="index-atexit-81"></a></var><br> — Built-in Function: <b>atexit</b> (<var>fcn, flag</var>)<var><a name="index-atexit-82"></a></var><br> <blockquote><p>Register a function to be called when Octave exits. For example, <pre class="example"> function last_words () disp ("Bye bye"); endfunction atexit ("last_words"); </pre> <p class="noindent">will print the message "Bye bye" when Octave exits. <p>The additional argument <var>flag</var> will register or unregister <var>fcn</var> from the list of functions to be called when Octave exits. If <var>flag</var> is true, the function is registered, and if <var>flag</var> is false, it is unregistered. For example, after registering the function <code>last_words</code> above, <pre class="example"> atexit ("last_words", false); </pre> <p class="noindent">will remove the function from the list and Octave will not call <code>last_words</code> when it exits. <p>Note that <code>atexit</code> only removes the first occurrence of a function from the list, so if a function was placed in the list multiple times with <code>atexit</code>, it must also be removed from the list multiple times. </p></blockquote></div> </body></html>