Coding Friction

Sanjay Prajapat

Composable Function

A composable function in Jetpack Compose is a special type of function used to define a UI component  that allows you to create reusable pieces of user interface. Here are some key points about composable functions: 1. Annotation: Composable functions are annotated with @Composable. 2. Reactive Updates: Composables are designed to be reactive. This means …

Composable Function Read More »

JetPack Compose Introduction

Jetpack Compose is a modern, declarative UI toolkit for building native Android apps. It’s part of the Android Jetpack family, which is a set of libraries, tools, and guidance for Android development. Compose was introduced by Google to simplify and accelerate the process of creating user interfaces for Android applications. Here are some key points …

JetPack Compose Introduction Read More »

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 Lambda Function

Lambda is a function which has no name. It is a concise way to define a block of code that can be passed around as an argument to higher-order functions or stored in a variable for later use. Lambda functions are useful in various contexts, such as higher-order functions, collections operations (like map, filter, and …

Kotlin Lambda Function Read More »

Kotlin Default and Named Argument

Default Arguments: Kotlin provides a facility to  assign default values to function parameters. When calling a function, if not provide a value for a parameter with a default value, the default value will be used. It allows you to call the function with fewer arguments if desired. Here’s an example of a function with default …

Kotlin Default and Named Argument Read More »

Kotlin Recursion function

A recursive function is a function that calls itself in its own definition.  Let’s look at an example of a simple recursive function to calculate the factorial of a number: When you call factorial(5), the recursive calls break down as follows: The function repeatedly calls itself with smaller values until it reaches the base case, …

Kotlin Recursion 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 »

Kotlin Array

Array is a collection of similar data types such as an Int, String etc. It is used to organize data so sorted and searched can be easily done. Arrays are mutable and fixed size, they are stored in contiguous memory locations. Create an Array : In Kotlin there are two ways to create an array 1. …

Kotlin Array Read More »

Kotlin Return and jump

These are the jump expression are used to control the flow of program execution. return : By default returns from the nearest enclosing function or anonymous function continue : Proceeds to the next step of the nearest enclosing loop break : It is used to  terminates the nearest enclosing loop. it is used to bring …

Kotlin Return and jump Read More »