Skip to content

Instantly share code, notes, and snippets.

@eungju

eungju/README.md

Last active Jul 2, 2017
Embed
What would you like to do?
Kotlin let run apply also

let

inline fun <T, R> T.let(block: (T) -> R): R = block(this)

run

inline fun <T, R> T.run(block: T.() -> R): R = block()

apply

inline fun <T> T.apply(block: T.() -> Unit): T { block(); return this }

also

inline fun <T> T.also(block: (T) -> Unit): T { block(this); return this }

                  리턴값이 리시버인가? block의 리턴값인가?

리시버가 block의 리시버가 되는가? apply run 파라메터가 되는가? also let

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment