## `Pref::callOnExit` -- defines an exit handler

#### Introduction

`Pref::callOnExit(`f`)` defines a function `f` which is called on exit of MuPAD.

#### Call(s)

`Pref::callOnExit(f)`
`Pref::callOnExit(list)`
`Pref::callOnExit(NIL)`
`Pref::callOnExit()`

#### Parameters

`f` | - | a function
`list` | - | a list of functions

#### Returns

`Pref::callOnExit` returns the previously defined function, list of functions, or `NIL`.

#### Related Functions

`_quit`, `Pref::postOutput`

#### Details

- `Pref::callOnExit(`f`)` defines a function `f` which is called on exit of MuPAD.
- `Pref::callOnExit(`list`)` defines a list of functions which are executed in the order of their occurence in `list` on exit of MuPAD.
- `Pref::callOnExit(`NIL`)` sets the default value, which is `NIL`.

- `Pref::callOnExit(``)` returns the current value.

#### Example 1

This example shows how to print some text on exit of MuPAD. It only works in the UNIX terminal versions of MuPAD:

    >> Pref::callOnExit(
         ()->print(Unquoted, "Good by, thank You for using MuPAD.")
       ):
       quit

                        Good by, thank You for using MuPAD.

In the frontends on all platforms the output is the following since

#### Background

- `Pref::callOnExit` can be used to send communication modules a disconnect message or to remove temporary user-defined files when leaving MuPAD.

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000