Coding Friction

Function

Infix Function

In Kotlin, infix functions allow you to call functions with a single argument without using the traditional dot and parentheses syntax. This can make your code more readable and expressive, especially when you’re working with DSLs (Domain Specific Languages) or building fluent APIs. To define an infix function in Kotlin, you need to: Here’s an …

Infix Function Read More »

Higher order function

In Kotlin, a higher-order function is a function that takes one or more functions as arguments, or returns a function as its result. It enables you to treat functions as first-class citizens, meaning you can use them just like any other values, such as integers or strings. Passing lambda expression as a parameter to Higher-Order …

Higher order function Read More »

Kotlin function

Functions are blocks of code that perform a specific task and can be called multiple times within a program. By using functions, we can avoid repeating the same code, which makes our program cleaner and more organized. functions are declared using fun keyword in kotlin Let’s create a simple example that calculates the area of …

Kotlin function Read More »