July 2018
Intermediate to advanced
400 pages
12h 14m
English
Table 9.1 summarizes the Kotlin standard library functions discussed in this chapter:
Table 9.1 Standard functions
| Function | Passes receiver to lambda as argument? | Provides relative scoping? | Returns |
|---|---|---|---|
| let | Yes | No | Lambda result |
| apply | No | Yes | Receiver |
| run a | No | Yes | Lambda result |
| with b | No | Yes | Lambda result |
| also | Yes | No | Receiver |
| takeIf | Yes | No | Nullable version of receiver |
| takeUnless | Yes | No | Nullable version of receiver |
|
a The non-receiver version of run (less commonly used) passes no receiver, performs no relative scoping, and returns the lambda result. b with is not called on the receiver like this: | |||
Read now
Unlock full access