Inline Functions

The inline function’s body is substituted for the function call on compilation. Often done when a function has a lambda expression to avoid the formation of a class and object in the background. – reduces overhead. Also beneficial when using Generics as it allows us to reify parameters. Not all functions are able to be inlined – depends on how function parameters are being used.

inline fun anyOldFunction() { // Add inline to the start of the declaration
}