

Task

Show the syntax for a complete stoppage of a program inside a   conditional.

This includes all threads/processes which are part of your program.

Explain the cleanup (or lack thereof) caused by the termination (allocated memory, database connections, open files, object finalizers/destructors, run-on-exit hooks, etc.).

Unless otherwise described, no special cleanup outside that provided by the operating system is provided.




// version 1.0.6
 
fun main(args: Array<String>) {
    val problem = true
    if (problem) System.exit(1) // non-zero code passed to OS to indicate a problem
    println("Program terminating normally")  // this line will not be executed
}