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
Related#
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 {
}