About goto in Kotlin

i found that there is not “goto” in Kotlin.
Could you tell me why? Didn’t i find it?
i think I’ll use “goto” occasionally,maybe it doesn’t matter to others

i do it.but i find nothing

My Google link was for “goto is evil”. It doesn’t give you any information on goto in Kotlin but lots of discussions about why goto may be considered harmful.

When Roman Elizarov talks about structured concurrency he refers to this blog, which includes a great explanation of the problems with goto.

I don’t know exactly why the Kotlin team decided against goto but I assume it’s because it is generally considered inferior to other jump expressions in a high level language such as Kotlin.

1 Like

i see. but It’s not very convenient.
sometimes,i may use “goto”.
i think “goto” can be saved

I think we learned as a humanity that goto is just wrong. It is a mistake we made at the beginning. It still probably makes sense in some low-level languages, but almost all modern and high-level languages decided to not include it: Kotlin, Swift, Java, Python, JavaScript, Rust, Dart and more (I may be wrong about some of them).