Kotlin is a programming language that is both general purpose and fun. It is a great language to learn for those who are newer and just getting into programming as well as the more experienced.
Kotlin is great for Android, Web Development, Desktop GUI, your next side project or just learning how to program for the first time.
Table of Contents
- Installing Kotlin
- Hello World
- Variables, Values, and Basic Math
- Console input output
- Conditional Statements - if and when
- Collections and Arrays
- Lambdas and Higher Order Functions
- Classes and Objects
- Data classes
- Intro to Coroutines
- Launch, Join, And Hundreds of Thousands of Jobs
- Web Services with Kotlin using Ktor (Installation)
A better Java
Kotlin was made to replace Java, perhaps one of the most widely used languages of today,by making a much simpler syntax as well as better support for more modern approaches of programming. The best part is that Kotlin and Java play together perfectly. So if you ever find a situation where you already have some Java code you can add newer Kotlin code with ease. If you are moving a project to Kotlin then you can update just one file at a time without breaking anything.
Java also has nearly 20-30 years of libraries, questions and answers, toolkits, and frameworks which port along to Kotlin because of this as well. So even if Kotlin feels newer, it has the mature support and tooling of a very well established language.
Inspired from the best
On top of improving Java, Kotlin also borrows some features from popular languages like Python, C#, Go, Ruby, C++, Rust etc. Not only does this make for a well designed language but also prepares you to learn those other popular languages and paradigms better.
The biggest improvement of Kotlin is in Android. As Android quickly became the most popular phone OS used by billions, Android for Java had to grow and change with it, becoming an overall clunky mess with bolted on layers. Java was not meant to be a language for this. People were not happy, creating tools like React Native, Xamarin, Cordova, Dart/Flutter. Turns out just improving the language itself was all that was needed.
It's hard to describe how much of a drastic improvement it is, but after it writing Android the old way will feel extremely tedious.
After a while, once you get used to the Kotlin way of doing things, it gets very fun. Your focus will move to what you want to do over how you express yourself. Just like how the code above starts with 'fun' this feeling sets in too as you learn more.
Made with love by the community
We're not related to any of the teams working on Kotlin, but just people who love Kotlin and want to teach others why we're so excited about it. Feel free to give any suggestions or even join in towards making this a better resource. For more details see our About page.