Logo

Programming-Idioms

History of Idiom 87 > diff from v5 to v6

Edit summary for version 6 by :

Version 5

2015-09-17, 06:18:45

Version 6

2015-10-22, 00:55:25

Idiom #87 Stop program

Exit immediatly.
If some extra cleanup work is executed by the program runtime (not by the OS itself), describe it.

Idiom #87 Stop program

Exit immediatly.
If some extra cleanup work is executed by the program runtime (not by the OS itself), describe it.

Code
erlang:halt(0).
Comments bubble
0_ means normal termination. Any other integer will result in that value being the exit status of the program.
A string will crash the vm and generate a crash report with that as the slogan.
The atom abort will cause the runtime system to abort, if that's allowed

For integer Status the Erlang runtime system closes all ports and allows async threads to finish their operations before exiting. To exit without such flushing use you can use erlang:halt(Status, [{flush, false}]).
Doc URL
http://erldocs.com/current/erts/erlang.html?i=0&search=halt#halt/0
Demo URL
http://tryerl.seriyps.ru/#id=23f3