In the following Kotlin/JVM program System.exit(-1)
stops the execution of the program with an error exit code:
fun main(args: Array<String>) {
if (args.size < 2) {
println("too few args!")
System.exit(-1)
}
println("Hello, ${args[1]} from ${args[0]}")
}
Kotlin/Native does not have access to any Java classes, including System
. So what would the equivalent function be for a Kotlin/Native program to stop execution of the program with an error code?
exit
function from C. – Reunite