end - terminate program execution




End causes all file buffers to be flushed, all open files to be closed, and program execution to terminate.  An implied call to end occurs when execution "falls off the end" of a program. 


The program
	    defint a-z
	    n = 1
	100 if n >= 1000 then end
	    print n
	    n = n + 1
	    goto 100
prints the first 999 positive integers and terminates. 

Of course, this example could be better written as

	defint a-z
	for n = 1 to 999
		print n
	next n
Note that the end in the final line of this example is optional. 

The end statement causes the process to exit with status zero.  For those users sufficiently familiar with UNIX to bemoan this, a special routine is provided in Basmark QuickBASIC that causes the process to exit with a given status.  For example,

	call bexit(99)
This program may be run and the exit status demonstrated (using the UNIX standard shell) is as follows:
	$ a.out
	$ echo $?


stop, system

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber