Created
August 21, 2021 13:11
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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