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 180 views
1 answer 283 views
283 views asked May 19, 2025 by avibootz
1 answer 241 views
241 views asked May 19, 2025 by avibootz
1 answer 324 views
324 views asked May 19, 2025 by avibootz
1 answer 255 views
255 views asked May 19, 2025 by avibootz
...