Mastering Kotlin standard functions: run, with, let, also and apply

Elye
Elye
Nov 14, 2017 · 6 min read

Some of the Kotlin’s standard functions are so similar that we are not sure which to use. Here I will introduce a simple way to clearly distinguish their differences and how to pick which to use.

Scoping functions

The functions that I’ll focus on are run, with, T.run, T.let, T.also, and T.apply. I call them…