dataspike
(Getting the hang of it)
2006-03-30 02:02 AM
What's better? Exit or Quit

What's better to call Exit or Quit?

Does one exit a Function and one exits a entire script?

Just a little confused.


ShawnAdministrator
(KiX Supporter)
2006-03-30 02:13 AM
Re: What's better? Exit or Quit

QUIT tells Kixtart to end processing, no matter where in the script you are. EXIT exits the current "context", which to my knowledge is:

mainline script - exit terminates processing
called script - exit leaves the called script
udf - exit leaves the udf

A function (UDF) or called script should (theoretically) never use QUIT.


Richard H.Administrator
(KiX Supporter)
2006-03-30 10:00 AM
Re: What's better? Exit or Quit

Quote:

A function (UDF) or called script should (theoretically) never use QUIT




One obvious exception is something like an ABORT() udf, which logs an exception, tidies up the environment and then exits KiXtart. But generally it is true, it is up to the calling script to decide to exit on a fatal error, not the udf.

Another context which "Exit" exits is the Execute() context. This is most often used to set a return value in the executed code.

A simple view is that Exit works exactly like a Return from the context, whereas Quit is used to exit KiXtart.