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 179 views
1 answer 282 views
282 views asked May 19, 2025 by avibootz
1 answer 240 views
240 views asked May 19, 2025 by avibootz
1 answer 323 views
323 views asked May 19, 2025 by avibootz
1 answer 254 views
254 views asked May 19, 2025 by avibootz
...