# stop statement

The stop statement stops program execution
and returns to the invoking the process.

## Syntax

```
stop
stop errnum, "parameter"{,"parameter"...}
```

## Parameter(s)

| errnum | Number of the error message to display. |
| --- | --- |
| parameter | Text to be displayed. |

## Description

The parameters are passed to
the error message handler and the message stored in *errnum* displays.

The stop statement is similar
to the abort statement, except the stop statement terminates execution of the program without going into
the FlashBASIC or BASIC debugger. Control returns to the calling program,
Proc, or macro.

## Example(s)

The stop statement
below stops program execution if `invoices` cannot
be opened, and prints the designated error message with a passed variable
parameter.

```
open "invoices" to inv.file else stop 201,"invoices"
```
If the invoices file does not exist, this message displays:

```
[201] ’invoices’ is not a file name
```
In this example, if the item referenced by the variable `ID` is not on file:

```
read cust.item from cust.file,ID else stop 202,ID
```
the program stops and displays:

```
[202] ’ID’ not on file.
```
The actual item-ID displays in the error message.

## See also

- [abort statement](https://d3codex.com/pickbasic-flashbasic/abort-statement/)
- [begin work statement](https://d3codex.com/pickbasic-flashbasic/begin-work-statement/)
- [end statement](https://d3codex.com/pickbasic-flashbasic/end-statement/)
- [error statement](https://d3codex.com/pickbasic-flashbasic/error-statement/)
- [messages file](https://d3codex.com/systemfiles/messages-file/)
- [open statement](https://d3codex.com/pickbasic-flashbasic/open-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/stop-statement/ - part of the D3Codex reference.
