Understanding let, apply, with, run in Kotlin
Issue #114
Picture worths thousand words. Code worths thousand pictures. I don’t understand much until I take a look at Standard.kt in Kotlin standard library.
| 1 | /** | 
- applyreturns T and accepts a block of type- T.() -> Unit. This is called Function Literals with Receiver
Kotlin provides the ability to call a function literal with a specified receiver object. Inside the body of the function literal, you can call methods on that receiver object without any additional qualifiers. This is similar to extension functions, which allow you to access members of the receiver object inside the body of the function
- letreturns R and accepts a block of type- T -> R. Inside the block, you can access- itwhich is it: implicit name of a single parameter