Skip to content

What do you know about when expressions? #950

@Kirchhoff-

Description

@Kirchhoff-

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Kotlin

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions