10.6 Exiting fscript

The quit() method is used to exit fscript with an optional exit code. It is available in all fscript invocations regardless of whether it is interactive or not.

Pass a numeric value to the method to control the exit code of the fscript call. If script does not provide an exit code, the fscript exit code defaults to 0. In the case of an unhandled exception, the exit code is -1.

To exit the fscript prompt, issue quit() as a command:

js> quit(exitCode)
#

Where, exitCode is an optional exit code.