After answering more than 300 Kotlin and Android interview questions, I was surprised to discover that one of the most fundamental Kotlin language features is still missing from the repository.
This issue aims to add a dedicated article about when expressions in Kotlin.
The article could cover:
- What
when is and why it is commonly used
when as a replacement for Java's switch
when statements vs expressions
- Returning values from
when
- Multiple matching branches
- Type checks with
is
- Smart casts
- Exhaustive
when expressions
- Working with sealed classes
when without an argument
- Common interview follow-up questions
The goal is to provide both a practical explanation and interview-oriented discussion around one of Kotlin's most frequently used language features.
After answering more than 300 Kotlin and Android interview questions, I was surprised to discover that one of the most fundamental Kotlin language features is still missing from the repository.
This issue aims to add a dedicated article about
whenexpressions in Kotlin.The article could cover:
whenis and why it is commonly usedwhenas a replacement for Java'sswitchwhenstatements vs expressionswheniswhenexpressionswhenwithout an argumentThe goal is to provide both a practical explanation and interview-oriented discussion around one of Kotlin's most frequently used language features.