Last active
August 21, 2021 12:36
-
-
Save magdamiu/ac7d6f5edd98b5103dc31e29e3cc64f6 to your computer and use it in GitHub Desktop.
Clean Code with Kotlin by Magda Miu - Meaningful names 2 - 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
class Book(val title: String?, val publishYear: Int?) | |
fun displayBookDetails(book: Book) { | |
val title = book.title ?: | |
throw IllegalArgumentException("Title required") | |
val publishYear = book.publishYear ?: return | |
println("$title: $publishYear") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment