How to run, let, also, apply in Kotlin

A short summary on Kotlin standard library functions: run, let, also, apply

2 minute read

If you decide to write Kotlin code, eventually you will see a lot of usage of the following 4 functions from standard library: run, let, also and apply. After doing a lot of research, I show simple examples of how to use them here. First, a helper class Student. class Student(name: String, age: Int, stuNum: String) { var name = name private set var age = age private set var stuNum = stuNum private set fun increaseAge() { age++ } fun nameToUpperCase() { name = name.