Switch in Kotlin
Switch statements express conditionals across many branches in Kotlin.
Here’s a basic when
(Kotlin’s switch equivalent):
To run the program, put the code in main.kt
and use kotlin
to execute it.
The output will be:
Now that we can run and build basic Kotlin programs, let’s learn more about the language.