These are similar but different, often confuse novice programmers:
- Break
Jump out of current loop.
- Exit
Jump out of current procedure (in macpas mode there is some extension that allows exiting multiple nested procedures iirc)
If in mainprogram, roughly the same as exit.
- Halt
Graceful exit (+/- jump to end of mainprogram)
- Halt(errnum)
Same but sets OS returncode to "errnum".
- RunError(errorcode)
Raises a runtime error and then exits. Since the runtime error number is returned in the OS returncode it is, as Molly's code shows, equal to halt(x)+backtrace.
- TApplication.Terminate
Shuts down an Application object, which internally calls halt after (typically GUI) app shuts down. The errorcode can be set in the application object iirc.
- TForm.Close
Closes the current form. If the current form is the main (first created) form, then it is equal to application.terminate.