Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Kotlin
/
Kotlin fundamentals
Why omit else from a when expression that lists every member of an enum?
from Kotlin fundamentals
Kotlin 2.4.10
intermediate
1 min
Why omit else from a when expression that lists every member of an enum?
It makes the generated bytecode always smaller.
A new enum member then makes the expression fail to compile until it is handled.
else is illegal for every enum subject.
It changes when from an expression into a statement.
Check
Ask AI about this kata
Report an error
next kata
count has type Int. Which expression passes it to fun store(value: Long)?
Quiz
A new version is available
Reload