Futurebasic/Language/Reference/on stop

From Wikibooks, open books for an open world
Jump to navigation Jump to search

ON STOP[edit | edit source]

Statement[edit | edit source]

(+) Appearance (+) Standard Console

Syntax[edit | edit source]

ON STOP {FN userFunction|GOSUB{lineNumber|"stmtLabel"}}

Description[edit | edit source]

This statement designates a particular function or subroutine as a stop-event handling routine. A stop-event handling routine is called just before your program ends. This works whether your program ends as a result of a statement (such as STOP or END), or a Command-period keypress by the user, or because it has executed the last line in the program.

<spacer type="vertical" size="1">A stop-event handling routine is useful for allowing your program to do any last-minute "clean-up" work, such as saving files, before your program ends.

Note:
You can't use a stop-event handling routine to prevent your program from stopping. Your program will end as soon as it returns from the routine. To prevent the user from stopping your program by means of a -period keypress, use the ON BREAK statement.

See Also[edit | edit source]

ON BREAK; STOP; END; SYSTEM statement