Kotlin Tutorials

48 tutorials across 16 topics. Each lesson includes code examples, a practice exercise, a quiz, and FAQs.

48 tutorials found

Beginner 5 min

What is Kotlin?

Learn what Kotlin is, why it was created, and where it is used. Understand Kotlin basics with simple explanations, code examples, and expected output.

Introduction
Beginner 6 min

Why Learn Kotlin?

Discover why Kotlin is worth learning in 2026. Understand Kotlin advantages, job market demand, and practical benefits with simple examples.

Introduction
Beginner 5 min

Kotlin Get Started

Get started with Kotlin in minutes. Write your first program, choose between IntelliJ IDEA and the online Kotlin Playground, and understand project structure.

Setup & Tools
Beginner 4 min

Kotlin Playground

Use the Kotlin Playground to run Kotlin code online without any installation. Learn how to use the playground for learning and sharing code.

Setup & Tools
Beginner 5 min

Kotlin Program Structure

Learn how a Kotlin program is structured. Understand packages, imports, top-level functions, and how multiple files work together.

Syntax Basics
Beginner 4 min

Kotlin main Function

Learn about the Kotlin main function — the program entry point. Understand the signature, command-line arguments, and what happens when main runs.

Syntax Basics
Beginner 4 min

Kotlin Comments

Learn all three types of Kotlin comments: single-line //, multi-line /* */, and KDoc /** */. Includes examples and best practices.

Syntax Basics
Beginner 5 min

Kotlin Output with println

Learn how to output text in Kotlin using println, print, and formatted output. Includes string templates, number formatting, and expected output.

Syntax Basics
Beginner 5 min

Kotlin Input with readln

Learn how to read user input in Kotlin using readln() and readLine(). Includes converting strings to numbers and handling null input.

Syntax Basics
Beginner 8 min

Kotlin Variables

Learn Kotlin variables with beginner-friendly examples. Understand val, var, type inference, reassignment, common mistakes, and expected output.

Variables & Data Types
Beginner 7 min

Kotlin Data Types

Learn all Kotlin data types with examples and expected output. Covers Int, Double, Float, Long, Boolean, Char, String, and Any.

Variables & Data Types
Beginner 8 min

Kotlin Strings

Learn Kotlin strings from scratch. Covers string declaration, accessing characters, length, concatenation, case conversion, and common string functions.

Strings
Beginner 6 min

Kotlin String Templates

Master Kotlin string templates. Learn to use $ for variables and ${} for expressions inside strings, with practical examples and expected output.

Strings
Beginner 5 min

Kotlin Raw Strings

Learn how to use Kotlin raw strings with triple quotes """...""". Great for multi-line text, JSON, SQL, and regex patterns without escape sequences.

Strings
Beginner 7 min

Kotlin Operators

Learn all Kotlin operators: arithmetic (+,-,*,/,%), comparison (==,!=,<,>), logical (&&,||,!), and bitwise. With examples and output.

Operators
Beginner 7 min

Kotlin If / Else

Learn Kotlin if, else if, and else with examples. Covers if as an expression, ternary alternative, and nested conditions.

Control Flow
Beginner 7 min

Kotlin When

Learn the Kotlin when expression — the powerful alternative to switch. Match values, ranges, types, and conditions with examples.

Control Flow
Beginner 7 min

Kotlin For Loop

Learn the Kotlin for loop with ranges, lists, maps, and indices. Includes downTo, step, and withIndex with expected output.

Control Flow
Beginner 6 min

Kotlin While Loop

Learn while and do-while loops in Kotlin with examples and expected output. Understand the difference and when to use each.

Control Flow
Beginner 6 min

Kotlin Ranges

Learn Kotlin ranges: inclusive .., exclusive until, downTo for reverse, and step. Includes character ranges and range checks.

Control Flow
Beginner 8 min

Kotlin Functions

Learn Kotlin functions from scratch. Covers declaration, parameters, return types, single-expression functions, and Unit return.

Functions
Beginner 6 min

Kotlin Default Arguments

Learn Kotlin default arguments — declare function parameters with preset values. Skip arguments you do not need to pass.

Functions
Intermediate 8 min

Kotlin Higher-Order Functions

Learn Kotlin higher-order functions — functions that accept or return other functions. Includes lambdas, function types, and practical examples.

Functions
Beginner 8 min

Kotlin List

Learn Kotlin lists. Covers listOf for read-only and mutableListOf for mutable lists, with add, remove, iteration, and filtering.

Collections
Beginner 6 min

Kotlin Set

Learn Kotlin Set — an unordered collection of unique elements. Covers setOf, mutableSetOf, contains, and set operations.

Collections
Beginner 8 min

Kotlin Map

Learn Kotlin Map — a collection of key-value pairs. Covers mapOf, mutableMapOf, put, get, iterate, and common map operations.

Collections
Beginner 8 min

Kotlin Classes

Learn how to create Kotlin classes. Covers primary constructor, properties, methods, instances, and init blocks with examples.

OOP
Beginner 7 min

Kotlin Data Classes

Learn Kotlin data classes. They auto-generate equals, hashCode, toString, copy, and componentN functions. Perfect for model objects.

OOP
Intermediate 8 min

Kotlin Inheritance

Learn Kotlin inheritance. Covers open classes, override, super, abstract classes, and why classes are final by default.

OOP
Intermediate 7 min

Kotlin Interfaces

Learn Kotlin interfaces. Covers abstract functions, default implementations, multiple interface implementation, and interface properties.

OOP
Intermediate 7 min

Kotlin Sealed Classes

Learn Kotlin sealed classes. Use them to model restricted sets of states with exhaustive when expressions. Ideal for UI state and API results.

OOP
Beginner 7 min

Kotlin Enums

Learn Kotlin enum classes for fixed sets of constants. Covers properties, methods, when expressions, and enum vs sealed class.

OOP
Beginner 7 min

Kotlin Companion Object

Learn Kotlin companion objects for factory methods, constants, and static-like APIs without Java static keyword.

OOP
Beginner 6 min

Kotlin object Declaration

Learn Kotlin object declarations for singletons, utility holders, and anonymous objects. Thread-safe lazy initialization included.

OOP
Beginner 9 min

Kotlin Null Safety

Master Kotlin null safety. Learn nullable types, safe call ?., Elvis operator ?:, not-null assertion !!, and smart casts.

Null Safety
Intermediate 10 min

Kotlin Coroutines Introduction

Learn Kotlin coroutines from scratch. Understand what coroutines are, why they exist, and how to use launch, delay, and runBlocking with examples.

Coroutines
Intermediate 8 min

Kotlin Lambdas

Learn Kotlin lambdas — anonymous functions. Covers syntax, it parameter, capturing variables, and use with filter, map, forEach.

Functional
Intermediate 7 min

Kotlin Extension Functions

Learn Kotlin extension functions — add new functions to existing classes without modifying them. Includes String, Int, and custom class extensions.

Functional
Intermediate 9 min

Kotlin Scope Functions

Learn all 5 Kotlin scope functions: let, run, with, apply, and also. Understand their context object and return value differences with examples.

Functional
Intermediate 8 min

Kotlin suspend Functions

Learn Kotlin suspend functions. Understand how suspend pauses a coroutine without blocking threads, and when you can call suspend code.

Coroutines
Intermediate 9 min

Kotlin launch and async

Learn when to use launch vs async in Kotlin. launch returns a Job; async returns Deferred for results with await().

Coroutines
Intermediate 8 min

Kotlin Coroutine Scope

Learn coroutineScope, supervisorScope, and structured concurrency in Kotlin. Cancel parent scopes to stop child coroutines safely.

Coroutines
Intermediate 8 min

Kotlin Coroutine Dispatchers

Learn Kotlin Dispatchers.Main, IO, and Default. Use withContext to switch threads for UI, network, and CPU work in coroutines.

Coroutines
Intermediate 7 min

Kotlin Try Catch

Learn Kotlin exception handling with try, catch, and finally. Covers custom exceptions, try as expression, and common exception types.

Exceptions
Intermediate 8 min

Kotlin Generics

Learn Kotlin generics — generic functions, generic classes, type bounds, and variance (in/out). With practical examples and expected output.

Generics
Intermediate 10 min

Kotlin Flow Introduction

Learn Kotlin Flow — a cold asynchronous data stream. Covers flow builders, collect, map, filter, flowOn, and the difference from LiveData.

Flow
Intermediate 8 min

Kotlin StateFlow

Learn Kotlin StateFlow — a hot flow that holds and replays the latest value. Perfect for Android ViewModel and UI state management.

Flow
Intermediate 8 min

Kotlin SharedFlow

Learn Kotlin SharedFlow for one-time events, broadcast streams, and configurable replay. Compare SharedFlow vs StateFlow for Android.

Flow