# abort statement

The abort statement immediately stops
program execution and unconditionally returns to the TCL command prompt.

## Syntax

```
abort {message#}{,"parameter"{,"parameter"...}}
abort {error.message.str}
```

## Parameter(s)

| message# | Item-ID of the message to output, located in the dm,messages, file. |
| --- | --- |
| parameter | Values required by the message. If the string form is used, the message string displays on the screen and placed in the dm,messages, file. |

## Description

The abort statement specifies an abnormal end and can appear anywhere in the
program.

The abort statement is similar to
the stop statement, except the abort statement also terminates execution of any macro or Proc that might
have called the program containing the abort statement
and aborts the FlashBASIC or BASIC program.

The abort statement automatically generates the error message:

```
"[b1] run-time abort at line ’ n’"
```

## Example(s)

If `"invoices"` cannot be opened, the program aborts with error message 201 and passes in the string `"invoices"`.

```
open "invoices" to invoice.file else abort 201,"invoices"
```
This causes the program to stop with the message:

```
"invoices" is not a file name
```
In this case, both [b201] and [b1] error messages display.

## See also

- [BASIC/FlashBASIC Debugger](https://d3codex.com/flashbasicdebugger/basic-flashbasic-debugger/)
- [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/)
- [stop statement](https://d3codex.com/pickbasic-flashbasic/stop-statement/)
- [u3090 user exit](https://d3codex.com/pickbasic-flashbasic/u3090-user-exit/)

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