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 93 views
1 answer 81 views
1 answer 146 views
146 views asked May 19, 2025 by avibootz
1 answer 137 views
137 views asked May 19, 2025 by avibootz
1 answer 207 views
207 views asked May 19, 2025 by avibootz
1 answer 139 views
139 views asked May 19, 2025 by avibootz
...