Scope functions in Kotlin

Kotlin scope functions are a special syntax to help us write more concise and idiomatic code which is also the one of the main motivation for using Kotlin programming language. It is important to understand that the scope functions are called so as they are always invoked in context of a scoped object - hence the name.

Following are the types of scope functions (remember these scope functions do not provide any additional functionality but provide smarter syntax to write compact code) :

	class Computer(var cpuType : String = "", var ramSize : Int=0)
	var computer2 = Computer().apply {
	    this.cpuType = "i9"
	    this.ramSize = 32
	}.also {
	    println("Configuration of computer : Cpu =  ${it.cpuType} , Ram = ${it.ramSize}")
	}