API Reference › Os › Os.exit
method

Os.exit

Os.exit(code)

Terminates the process immediately with the given status code — 0 for success, non-zero for failure, the convention every shell and CI system reads. Nothing after the call runs. Intended for tools and launchers; a game normally ends through its own lifecycle instead.

Parameters

codethe process exit status (0 = success)

Example

program Exit {
  entry {
    if Os.arg_count() < 2 {
      Os.stderr_write("usage: tool <arg>\n")
      Os.exit(1)
    }
    print(0)
  }
}
← All symbols