Kotlin

Kotlin If Statement Example1 min read

Code:

Output:




If statement in Kotlin is different from traditional if statment in programming.

In Kotlin if expression returns a value and store into a variable.

In Kotlin else branch is mandatory when we use if expression. But in java it will allow with only if statment.

Please refer to the above program to get more understanding about if statement in Kotlin.

Leave a Comment