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 108 views
1 answer 95 views
1 answer 175 views
175 views asked May 19, 2025 by avibootz
1 answer 158 views
158 views asked May 19, 2025 by avibootz
1 answer 237 views
237 views asked May 19, 2025 by avibootz
1 answer 171 views
171 views asked May 19, 2025 by avibootz
...