inline, noinline, crossinline, reified in kotlin with examples

<p>When I was learning Kotlin, I was so confused about these terms like inline, noinline etc. I searched deeply to understand better and kept some notes. I wanted to share these notes with you, I hope these will be helpful to you!</p> <h1>inline functions</h1> <p>An inline function in Kotlin is a type of function that instead of calling and executing the function code at the function call point, the code is copied and pasted at the call point, this process is called inlining.</p> <p>For example, you have a simple function that divides a number by 3:</p> <p><iframe frameborder="0" height="105" scrolling="no" src="https://towardsdev.com/media/98b34cd802dbb18969bdb1487015204d" title="main.kt" width="680"></iframe></p> <p>When you call this function, it needs to go through the process of calling and executing the function, this process takes some time and it could be a problem if the function is called many times, instead you can make this function inline,</p> <p><a href="https://towardsdev.com/inline-noinline-crossinline-reified-in-kotlin-with-examples-f5dd063a0cd8">Website</a></p>