Program termination: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Added Quackery.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(7 intermediate revisions by 4 users not shown)
Line 616:
or
<syntaxhighlight lang="delphi">System.Halt(1); // Optional exit code</syntaxhighlight>
 
=={{header|dt}}==
<syntaxhighlight lang="dt">[quit] true do?</syntaxhighlight>
 
=={{header|E}}==
Line 642 ⟶ 645:
 
Functions in <code>kill-emacs-hook</code> are called. (Except prior to Emacs 24 that hook was not run when in <code>-batch</code> mode.) The underlying C library <code>atexit()</code> handlers are called.
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
^| I try to use the exit codes described at:
| https://github.com/openbsd/src/blob/master/include/sysexits.h
|^
int EX_SOFTWARE = 70 # internal software error
logic hasProblem = true
if hasProblem do exit EX_SOFTWARE end
</syntaxhighlight>
{{out}}
<pre>
emal.exe Org\RosettaCode\ProgramTermination.emal
echo Exit Code is %errorlevel%
Exit Code is 70
</pre>
 
=={{header|Erlang}}==
Line 717 ⟶ 736:
exit code is 1
</pre>
 
=={{header|FutureBasic}}==
Quick and dirty. Terminates everything.
<syntaxhighlight lang="futurebasic">
if condition then end
</syntaxhighlight>
 
=={{header|Gambas}}==
Line 957 ⟶ 982:
<syntaxhighlight lang="javascript">if (some_condition)
quit();</syntaxhighlight>
 
=={{header|Joy}}==
<syntaxhighlight lang="joy">[true] [quit] [] ifte.</syntaxhighlight>
 
=={{header|jq}}==
Line 1,511 ⟶ 1,539:
next
</syntaxhighlight>
 
=={{header|RPL}}==
There are 2 ways of terminating a program in RPL.
'''IF''' problem '''THEN''' HALT '''END'''
Here, nothing is cleaned up: local variables are still existing and a step-by-step execution is possible thanks to the <code>SST</code> instruction, typically for debugging. Once the bug found, a manual cleanup must be done through the <code>KILL</code> instruction.
If a full termination with cleanup is desired, it must be written:
'''IF''' problem '''THEN''' ABORT '''END'''
All currently running processes are then terminated, all local variables are discarded and control is given back to the user.
 
=={{header|Ruby}}==
Line 1,817 ⟶ 1,853:
 
The following example illustrates the use of Fiber.suspend in a Wren CLI script.
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdin, Stdout
 
System.write("Do you want to terminate the program y/n ? ")
Line 1,830 ⟶ 1,866:
{{out}}
<pre>
$ wren_cli program_terminationProgram_termination.wren
Do you want to terminate the program y/n ? y
OK, shutting down
9,476

edits