Futurebasic/Language/Reference/on stop

Description
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  or  ), or a Command-period keypress by the user, or because it has executed the last line in the program.

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  statement.