Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created August 21, 2021 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/11e7f8fb306c2141b5e8ba88c52d5807 to your computer and use it in GitHub Desktop.
Save magdamiu/11e7f8fb306c2141b5e8ba88c52d5807 to your computer and use it in GitHub Desktop.
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