exit_program

exit_program — terminates the interpreter.

Syntax

exit_program (return_value)

		

Arguments

return_value

An integer value to be returned to the operating system when the program exits.

Returns

This function does not return.

Description

Terminate the interpreter immediately and return the provided integer value to the operating system as an exit code.

Example

Running this program...

#!/usr/cogent/bin/gamma

//Program: exiting.g

atexit(#princ("Exiting now.\n"));
princ("Started running...\n");
princ("Still running.\n");
exit_program(7);
princ("You missed this part.\n");
		

...gives these results:

[]$ gamma exiting.g
Started running...
Still running.
Exiting now.
[]$ 
Exit showing abnormal termination of -1 (255) to the operating system.

exit_program(-1);

/>echo $?
255
/>