June 2018
Intermediate to advanced
310 pages
6h 32m
English
Like some other modern languages, Kotlin provides us with the ability to set default values for function parameters:
data class Mail(val to: String, val title: String = "", val message: String = "", val cc: List<String> = listOf(), val bcc: List<String> = listOf(), val attachments: List<java.io.File> = listOf())
So, if you would like to send an email without CC, you can do it like that now:
val mail = Mail("one@recepient.org", "Hi", "How are you")
But what about the case where you want to send an email with BCC? Also, not having to specify order with fluent setters was very handy. Kotlin has named arguments for that:
val mail = Mail(title= "Hello", message="There", to="my@dear.cat")
Combining default ...
Read now
Unlock full access