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…
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…
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:…
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…
What is Array in kotlin? 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…
These are the jump expression are used to control the flow of program execution. return break continue return : By default returns from the nearest enclosing function or anonymous function…
do-while loop first executes the code of do block then it checks the condition. do-while loop executes at least once even the condition of while is false. Syntax do{ //block of…
It is used to iterate a part of code several times. It executes until the condition is true. Syntax while(condition){ //this code executes } let's take an example: fun main(args:…
It is used to iterate a part of code several times. it iterate through array, collection(like list, map), ranges, String. If body of for loop have only single statement we…
when is the replacement of the switch operator of java. Block of code will executed when some condition is satisfied, also when expression can returns value using braces we can…
Kotlin Control Flow Statements It is used to control the flow of program structure, following types of expression in kotlin. if Expression if-else expression if-else if-else ladder expression nested if…