kotlin

kotlin

Kotlin example program to reverse a number

This tutorial will show you how to reverse a number in Kotlin. We will learn two different ways to do that. The first method will use one loop and the second method will use a different approach to solve it. This program will take the number as an input from the user, calculate the reverse and print it to the user.

Read
kotlin

Kotlin if-else expression explanation with examples

if-else is used in almost all programming languages. These are basic control statements and we can control the programming flow based on a condition. Similar to any other programming language, we can use if-else in kotlin with a condition. In kotlin, we can also use if-else as an expression i.e. if-else returns a value!

Read
kotlin

Kotlin take method explanation with different examples

take() method is defined in Kotlin standard library. This method can be used with an array or iterable. In this tutorial, we will learn how to use take method in kotlin with example. The program will show you how take works on arrays with a different data type.

Read
kotlin

Find the maximum of two or three values in Kotlin using maxOf function

Kotlin standard library comes with a lot of different functions derived under different packages. For example, if we want to find out the largest of two or three numbers in Kotlin, we can either write our own comparison function or use the one that is provided under the standard library.

Read
kotlin

Kotlin program to calculate simple interest with user input values

In this kotlin programming tutorial, we will learn how to calculate simple interest by using the user provided values.The user will enter the values and the program will calculate the simple interest.

Read
kotlin

Kotlin program to check if a string contains another substring

In this kotlin programming tutorial, we will learn how to check if a substring exists in another string or not. The program will take the strings as input from the user and print out the result.

Read
kotlin

Kotlin program to find out the largest among three numbers

In this Kotlin programming tutorial, we will learn how to find out the largest number among the three. The user will enter the number values, our program will find and print out the result.

Read
kotlin

Kotlin program to access a character in a string by index

This kotlin program is to show you how we can access a character in a string using index position. The program will take one string as input from the user. Next, it will take the index position. The output of the program will be the character at that user defined index position in the string.We will learn two different ways to solve this program.

Read
kotlin

Kotlin program to print each character of a string (4 different ways)

In this kotlin programming tutorial, we will learn how to print each character of a string in kotlin. The program will take the string as input from the user and print out all characters of it one by one.

Read
kotlin

Kotlin program to reverse a string recursively

In this kotlin programming tutorial, we will learn how to reverse a string recursively in kotlin. The program will take the string from the user and reverse it.We will use one separate method and call it recursively to reverse the string.

Read