June 2018
Intermediate to advanced
310 pages
6h 32m
English
So, at 10 A.M., I plan to drink a coffee in my local cafe. But I also want to contact my manager, since my payslip didn't arrive yesterday. I attempt to create my first email like so:
val mail = Mail("manager@company.com", // TO null, // CC null, // BCC "Ping", // Title null // Message)
This may have worked in Java, but in Kotlin this wouldn't compile, since we cannot pass null to List<String>. Null-safety is very important in Kotlin:
val mail = Mail("manager@company.com", // TO listOf(), // CC listOf(), // BCC "Ping", // Title null // Message)
Note that since our constructor receives a lot of arguments, I had to put in some comments, so I wouldn't get lost.
Read now
Unlock full access