FeaturedIT topics

Kotlin tutorial: Get started with Kotlin

As I discussed in my article “What is Kotlin? The Java alternative explained,” Kotlin is a general purpose, open source, statically typed “pragmatic” programming language that combines object-oriented and functional programming features. You can use Kotlin to build applications for the Java Virtual Machine (JVM), Android, browsers, and native apps on MacOS, Linux, Windows, iOS, WebAssembly, and Android. Kotlin was created by JetBrains and released to open source under the Apache 2 license.

Why learn Kotlin? The short answer is that Kotlin is a better language for the JVM than Java. Kotlin is less verbose, supports all the features of functional programming, eliminates the danger of null pointer references, streamlines the handling of null values, and maintains 100 percent interoperability with Java and Android. All of that will make you a more productive programmer than you would be writing Java, even if you start by using Kotlin to build new features into an existing Java application.

Try Kotlin online

You can try Kotlin online without installing anything on your computer. On the try.kotlinlang.org site (shown below) you might start by reading through and trying the examples, working through the Kotlin Koans, and then, if you want additional reinforcement, trying all the Kotlin in Action examples. Both the Problems section and the Koans provide unit tests and ask you to code answers that satisfy all of the tests. The knowledge needed to complete the Problems section is covered in previous sections; the Koans contain links to the appropriate Kotlin documentation in addition to a problem statement and a code skeleton.

For extra credit, join Advent of Code and use the appropriate section of the Try Kotlin site to code your answers. You can log into both the Kotlin and Advent of Code sites with your existing social media credentials.

Related Articles

Back to top button