January 2018
Intermediate to advanced
434 pages
14h 1m
English
Follow these steps to understand function literals:
fun main(args: Array<String>) { var str1 = "The start of a " val addStr = fun String.(successor: String): String { return this + successor } str1 = str1.addStr("beautiful day.") println(str1)}
A function literal has access to the receiver it has been called on, and it can access methods associated with that receiver.
Read now
Unlock full access