Kotlin Tutorial #14: Error Handling — try/catch, Result, and Patterns

In the previous tutorial, you learned about interfaces and generics. Now let’s learn about error handling. Every program needs to handle errors. Kotlin gives you several tools for this, from traditional try/catch to the modern Result type. In this tutorial, you will learn: try/catch/finally try as an expression Custom exceptions The Result type (runCatching, getOrElse, map, fold) Sealed classes for errors Error handling patterns and best practices try/catch/finally The try/catch block catches exceptions. finally always runs, even after an exception. ...

March 22, 2026 · 8 min

Kotlin Tutorial #13: Interfaces, Generics, and Type Constraints

In the previous tutorial, you learned about sealed classes, enum classes, and value classes. Now let’s learn about interfaces, generics, and type constraints. These features let you write flexible, reusable code while keeping type safety. In this tutorial, you will learn: Interfaces and multiple inheritance Generics with <T> Type constraints with where Variance — in and out Star projection * Reified type parameters Interfaces An interface defines a contract. Classes that implement the interface must provide the required functions and properties. ...

March 22, 2026 · 8 min

Kotlin Tutorial #12: Sealed Classes, Enum Classes, and Value Classes

In the previous tutorial, you learned about scope functions. Now let’s learn about three important types in Kotlin: enum classes, sealed classes, and value classes. Each one solves a different problem, and knowing when to use which will make your code better. In this tutorial, you will learn: Enum classes — fixed set of constants Sealed classes — restricted hierarchies with different data Sealed interfaces — multiple inheritance with sealed types Value classes — type safety without runtime overhead When to use which Enum Classes An enum class defines a fixed set of constants. Every value is known at compile time. ...

March 22, 2026 · 9 min

Kotlin Tutorial #10: Extension Functions and Properties

In the previous tutorial, you learned about lambdas and higher-order functions. Now let’s learn about extension functions and properties. Extensions let you add new functions and properties to existing classes without modifying them. This is one of Kotlin’s best features. You can add a toSlug() function to String or a secondOrNull() function to List — without changing the original class. In this tutorial, you will learn: Extension functions Practical extensions like String.toSlug() and List.secondOrNull() Extension properties Extensions on nullable types Companion object extensions Generic extensions Extension Functions An extension function adds a new function to an existing class. The class you extend is called the “receiver.” ...

March 22, 2026 · 8 min

Kotlin Tutorial #9: Lambdas and Higher-Order Functions

In the previous tutorial, you learned about collections. Now let’s learn about lambdas and higher-order functions. These are some of the most powerful features in Kotlin. A lambda is a function without a name. You already used lambdas with filter, map, and other collection functions. In this tutorial, you will learn how they work in depth. In this tutorial, you will learn: Lambda syntax and the it keyword Trailing lambdas Function types like (Int) -> String Higher-order functions (functions that take or return functions) Function references Closures Inline functions Lambda Syntax A lambda is written between curly braces { }. The arrow -> separates the parameters from the body. ...

March 22, 2026 · 9 min

Kotlin Tutorial #8: Collections — List, Set, Map, and Operations

In the previous tutorial, you learned about classes. Now let’s learn about collections — one of the most important topics in Kotlin. You will use collections in almost every program you write. Kotlin’s collections are powerful and expressive. You can filter, transform, group, and combine data with just a few lines of code. In this tutorial, you will learn: List, MutableList, Set, and Map filter, map, flatMap groupBy, sortedBy reduce and fold zip and associate Chaining operations together List A List is an ordered collection. listOf creates a read-only list. mutableListOf creates a list you can change. ...

March 22, 2026 · 8 min

Kotlin Tutorial #1: What is Kotlin? A Simple Guide for Developers

Kotlin is a modern programming language that runs on the Java Virtual Machine (JVM). Google made it the official language for Android development in 2019. But Kotlin is not just for Android. You can use it for backend servers, desktop apps, and even web development. In this tutorial, you will learn what Kotlin is, where it is used, and why so many developers prefer it over Java. You will also write your first Kotlin code. ...

March 19, 2026 · 7 min

Kotlin Tutorial #11: Scope Functions — let, run, with, apply, also

In the previous tutorial, you learned about extension functions. Now let’s learn about scope functions. Kotlin has five scope functions: let, run, with, apply, and also. They execute a block of code on an object and differ in how they refer to the object and what they return. These functions are used everywhere in Kotlin code. Understanding them will make your code cleaner and more readable. ...

March 19, 2026 · 9 min

Kotlin Tutorial #17: Coroutines — launch, async, and Structured Concurrency

In the previous tutorial, you learned about sequences. Now let’s learn about coroutines. Coroutines are Kotlin’s way of writing asynchronous code. They let you write code that looks synchronous but runs without blocking threads. In this tutorial, you will learn: Suspend functions launch — fire and forget async/await — get a result Dispatchers coroutineScope Structured concurrency Jobs and cancellation Timeouts Practical examples What Are Coroutines? A coroutine is a lightweight thread. You can run thousands of coroutines on a single thread. Unlike threads, coroutines are cheap to create and do not block the operating system thread they run on. ...

March 19, 2026 · 9 min

Kotlin Tutorial #2: Installing Kotlin and Your First Program

In the previous tutorial, you learned what Kotlin is and why developers love it. Now it is time to install Kotlin on your computer and write your first program. In this tutorial, you will: Install IntelliJ IDEA (the best IDE for Kotlin) Create a Kotlin project Write and run your first programs Try the Kotlin REPL Use the Kotlin Playground (no installation needed) Option 1: Kotlin Playground (No Installation) If you want to try Kotlin right now without installing anything, go to the Kotlin Playground. ...

March 19, 2026 · 8 min