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, begin work Statement, end Statement, error Statement, messages File, open Statement, Statements and Functions