Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clean Code with Kotlin by Magda Miu - Error Handling 2 - Sealed Classes Improved Version - Clean Code
val <T> T.exhaustive: T
get() = this
fun displayMovieResult(movieResult: MovieSearchResult) {
when(movieResult) {
is MovieFound -> println("yey, we found the movie")
is MovieNotFound -> TODO()
}.exhaustive
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment