For Loop in Kotlin

In Kotlin, the for loop is a control flow statement that allows you to iterate over a range, an array, a collection, or any other type of iterable object. The … Read more

When expression in Kotlin

In Kotlin, the when statement can also be used as an expression that returns a value. This is known as the when expression. The syntax is similar to the when … Read more

When in Kotlin

In Kotlin, when is a control flow statement that provides a more concise alternative to the traditional switch statement found in other programming languages. The when statement allows you to … Read more

Kotlin do While Loop

In Kotlin, the do-while loop is a control flow statement that executes a block of code repeatedly while a condition is true, but with a different flow than the regular … Read more

Kotlin While Loop

In Kotlin, the while loop is a control flow statement that executes a block of code repeatedly while a condition is true. The general syntax of a while loop is: … Read more

Kotlin If..Else Expressions

In Kotlin, the if statement can be used as an expression, which means it returns a value that can be assigned to a variable or used in other expressions. When … Read more

Kotlin else if statement

In Kotlin, else if is used to chain multiple conditions together in a conditional statement. It allows you to test multiple conditions and execute different code blocks based on the … Read more

if statement in Kotlin

In Kotlin, the if statement is used for conditional branching. It is similar to the if statement in other programming languages, but it has some additional features that make it … Read more

How to access String in Kotlin?

In Kotlin, you can access individual characters in a string using the indexing operator []. Here are a few examples: Note that the [] operator returns a Char value, which … Read more

String functions in Kotlin Part – 2

contains: This function returns true if the string contains a specified substring. startsWith/endsWith: These functions return true if the string starts with or ends with a specified substring. split: This … Read more