While functions are a great way to write modular code, it may sometimes increase program execution time and reduce memory optimization due to function stack maintenance and overhead. Inline functions are a great way to avoid those hurdles in functional programming. For example, see the following code snippet:
fun doSomeStuff(a:Int = 0) = a+(a*a) fun main(args: Array<String>) { for (i in 1..10) { println("$i Output ${doSomeStuff(i)}") } }
Let's recite the definition of inline function; it says that inline functions are an enhancement feature to improve the performance and memory optimization of a program. Functions can be instructed to the compiler to make them inline so that the compiler can replace those function definitions ...