Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

exit

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Sets the exit code or exit expression for an entry point.

Syntax: main args <name> exit <expr> <block>

Category#

function

Examples#

radix/corpus/reference/keyword/exitus/exitus.fab (canonical · keyword)#

Sets the exit code or exit expression for an entry point.

# =============================================================================
# exit — Sets the exit code or exit expression for an entry point
# =============================================================================
#
# What this teaches:
#   • Sets the exit code or exit expression for an entry point.
#   • Related keywords: main, async_main, args
#
# Common mistakes:
#   • Using `throw` without a `⇥` on the enclosing function — `throw` requires an enclosing function with a `⇥` alternate-exit type (SEM010).
#
# See also: main, async_main, args
# =============================================================================

# exit — CLI exit code on entry
#
# GRAMMAR:
#   entryModifier :← 'exit' integer
#
# EXPECTED OUTPUT:
#   The entry terminates with exit code 1, as selected by `exit 1` below.
#

@ cli { name = "exitus-smoke" }
main args args exit 1 {
}