How to stop a program in Kotlin

1 Answer

0 votes
import kotlin.system.exitProcess


fun main() {
    println("abc")

    exitProcess(0) // 0 indicates successful termination

    println("xyz") // unreachable code
}


 
/*
run:
 
abc
 
*/

 



answered May 19, 2025 by avibootz

Related questions

1 answer 181 views
1 answer 284 views
284 views asked May 19, 2025 by avibootz
1 answer 242 views
242 views asked May 19, 2025 by avibootz
1 answer 327 views
327 views asked May 19, 2025 by avibootz
1 answer 256 views
256 views asked May 19, 2025 by avibootz
...