Start a Project

Get Started with Kotlin on Android

In this blog, we’re going to take a look at Kotlin, a new language in the JVM world, and some of its basic features, including classes, inheritance, conditional statements, and looping constructs.

Defining function in kotlin

Defining variables

Using when expression it’s more like switch case.

Using a for loop

Constructors

A class in Kotlin can have a primary constructor and one or more secondary constructors. The primary constructor is part of the class header  it goes after the class name (and optional type parameters).

Have you notice there no semicolon in sentences in Kotlin you don’t have to put the semicolon at the end of sentences. Null-safety is an important feature of the Kotlin language. It helps developers avoid NullPointerExceptions and improves the quality of their apps.

Exit mobile version