Kotlin Topics

This category contains all the topics related to functions, strings, array, exception etc. in Kotlin.

Try expression in Kotlin

The Try can be also used as Try expression in Kotlin. The Try expression returns the last expression of try block or last expression of catch. The finally block working doesn’t get affected in Try expression. To understand Try expression is Kotlin please check out the following example program. Example Program without Exception: fun main(args: Array<String>){ val str = …

Try expression in Kotlin Read More »

String in Kotlin

In this tutorial, we will learn about String in Kotlin. A string is an array of characters(char type values) and String class is used to represent strings in Kotlin. It is important to note just like Java, String is an immutable class in Kotlin it means we can not change of object once after creation. Creating a String …

String in Kotlin Read More »

Ranges in Kotlin

In this tutorial, we will learn about Ranges in Kotlin. This is a very amazing feature provided by Kotlin with the help of ranges we can create a collection of values by just defining starting and ending value. For example, you want to create a series of 1 to 10 this can be easily done with …

Ranges in Kotlin Read More »

Array in Kotlin

In this tutorial, we will learn about Array in Kotlin. The array is also known as a collection of homogeneous data elements. In arrays, we can store multiple values in contiguous memory locations. Furthermore, we store and fetch data with the help of index numbers. It is important to note, In kotlin array is not a data type. …

Array in Kotlin Read More »

Function in Kotlin

In this tutorial, we will learn about Function in Kotlin.  A function is a small piece(block) of code which can perform some special task and it only executes when we call this function. The function allows us to reuse code. In Kotlin we use the fun keyword to declare a function. fun functionName(parameterName: parameterType, parameterName: parameterType): returnType { //body …

Function in Kotlin Read More »

Scroll to Top