QUIT
QUIT [ ExitCode ]
End the program immediately.
All windows are closed, then deleted, and everything is freed as cleanly as possible.
Seit 3.18
QUIT
ends the process brutally, without letting the C library and the shared libraries call their clean-up routines.
Examples
PUBLIC FUNCTION Calcmean(fSum AS Float, fCount AS Float) AS Float
IF fCount = 0 THEN
PRINT "Division by 0 in function Calcmean"
QUIT
ENDIF
RETURN fSum / fCount
END
This instruction is not very successful in freeing things with GUI programs. So you should use it only with console applications.
Do not underestimate the above warning about using Quit to exit a GUI program that does not want to close.
If you are having to use Quit to exit a GUI program you probably have another problem that needs looking into.
You must find and fix the error that stops your program exiting normally.
Quit "ends the process brutally". This may leave residual tmp folders and folders in in
/cache or /local/share/gambas that would otherwise be cleaned up.
Do not be tempted.
IT IS NOT A QUICK FIX FOR A GUI PROGRAM THAT WON'T EXIT!
It is valid to use it in a GUI application startup routine that may exit before anything else loads, for example with command line arguments that might perform a small function that does not load the application.
Exit code
Seit 3.4
You can optionally specify the exit code returned by the program to the parent process.
By default, the exit code is
0
.
See also