Skip to content
Tutorials Center
My learning

Topics

Kotlin Tutorial

Learn Kotlin 2.4 from your first program to null safety, collections, classes, generics, coroutines, flows and real projects. 134 lessons with Kotlin that compiles and runs in your browser, quizzes and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 Introduction to Kotlin What Kotlin is, where it runs (JVM, Android, servers, multiplatform), where it came from and why teams pick it. Includes four runnable examples.
  2. 2 Your First Kotlin Program Write and run your first Kotlin program. Learn fun main, println vs print, statements, comments, main with arguments and the most common beginner errors.
  3. 3 How Kotlin Code Runs Understand how Kotlin source becomes a running program - kotlinc, JVM bytecode, the standard library, compile errors vs run-time errors, scripts, projects and IDEs.
  4. 4 Variables: val and var Learn Kotlin variables: val (read-only) vs var (mutable), type inference, explicit types, naming rules, const val, shadowing and late initialization, with runnable examples.
  5. 5 Basic Types A complete tour of Kotlin's basic types - Int, Long, Short, Byte, Double, Float, Boolean and Char - with literals, ranges, underscores and why there is no implicit widening.
  6. 6 Working with Numbers Calculate with numbers in Kotlin - integer division, remainder, overflow, rounding, kotlin.math, BigInteger and BigDecimal for exact results, and unsigned types.
  7. 7 Strings Learn Kotlin strings - immutability, escapes, raw strings with trimIndent, indexing, common functions, comparison, StringBuilder, Char and Unicode pitfalls, with runnable examples.
  8. 8 String Templates and Formatting Learn Kotlin string templates and formatting - $name, ${expression}, escaping the dollar sign, format() and %-specifiers, padStart, padEnd, number rounding, buildString and aligned tables.
  9. 9 Reading Input Learn how Kotlin reads input - readln, readlnOrNull, readLine, parsing numbers with toInt and toIntOrNull, reading until end of input, splitting tokens and building small interactive programs.
  10. 10 Operators Learn Kotlin operators - arithmetic, comparison, logical, assignment, increment, bitwise functions like shl and and, the in and is operators, precedence rules and a preview of operator overloading.

Control Flow

  1. 11 if as an Expression Learn Kotlin's if expression - if/else as a value, blocks that return their last line, else-if chains, why Kotlin has no ternary operator, the missing else error, and smart casts in conditions.
  2. 12 when Expressions Learn Kotlin's when expression - matching values, ranges, types and conditions, subject-less when, exhaustiveness with enums and sealed types, guard conditions, and when versus if-else chains.
  3. 13 Loops Learn Kotlin loops - for over ranges and collections, while and do-while, step, downTo, until, indices, withIndex and repeat, with runnable examples and common pitfalls.
  4. 14 break, continue and Labels Learn how break and continue work in Kotlin, how labeled loops escape nested loops, how return@label works in lambdas, and what non-local break and continue in inline lambdas do.
  5. 15 Ranges and Progressions Understand Kotlin ranges and progressions - IntRange, CharRange, in checks, rangeUntil, reversed, step, floating-point ranges, custom ranges and the pitfalls, with runnable examples.
  6. 16 Null Safety Learn Kotlin null safety - nullable types, safe calls, the Elvis operator, !!, let, smart casts, safe casts, lateinit and platform types, with runnable examples and the real compiler errors.
  7. 17 Type Checks and Casts Learn Kotlin type checks and casts - is and !is, smart casts, as and as?, ClassCastException, Any, generic erasure and star projections, with runnable examples and real error messages.
  8. 18 Exceptions Learn Kotlin exceptions - try/catch/finally as expressions, throw, the exception hierarchy, custom exceptions, no checked exceptions, runCatching and use, with runnable examples and real error output.
  9. 19 Any, Unit and Nothing Learn Kotlin's top and bottom types - Any, Unit and Nothing - plus TODO(), error(), require() and check(), with runnable examples and the real compiler messages.

Functions

  1. 20 Functions Learn how to declare Kotlin functions - fun, parameters, return types, single-expression bodies, Unit, top-level functions and common compiler errors, with runnable examples.
  2. 21 Default and Named Arguments Learn Kotlin default parameter values and named arguments - how to skip arguments, mix positional and named calls, avoid overloads and use @JvmOverloads for Java.
  3. 22 Varargs and the Spread Operator Learn Kotlin vararg parameters and the spread operator - passing any number of arguments, arrays and lists, named varargs, copies, and the typical compiler errors.
  4. 23 Local and Nested Functions Learn Kotlin local functions - declaring functions inside functions, capturing variables as closures, declaration order, recursion, and when a local function beats a private helper.
  5. 24 Lambdas Learn Kotlin lambda expressions - syntax, the implicit it parameter, trailing lambda syntax, closures, return@label, function types and common mistakes, with runnable code.
  6. 25 Higher-Order Functions Learn Kotlin higher-order functions - passing functions as parameters, returning functions, callable references with ::, bound references, closures and common mistakes, with runnable code.
  7. 26 Inline Functions Learn Kotlin inline functions - what inline does, non-local return, noinline and crossinline, reified type parameters, performance trade-offs and common compiler errors, with runnable code.
  8. 27 Extension Functions Learn Kotlin extension functions and extension properties - receivers, static resolution, nullable receivers, member-wins rule, scope and best practices, with runnable examples.
  9. 28 Scope Functions Learn Kotlin scope functions let, run, with, apply and also - how they differ in receiver and result, when to pick each, takeIf, nesting pitfalls and idiomatic examples with runnable code.
  10. 29 Infix Functions and Operator Overloading Learn Kotlin infix functions and operator overloading - plus, get, invoke, compareTo, contains, unary operators, component functions, rules and mistakes, with runnable examples.
  11. 30 Recursion and tailrec Learn recursion in Kotlin - base cases, the call stack, StackOverflowError, tail recursion with the tailrec modifier, accumulators, iterative alternatives and when each approach fits.
  12. 31 Function Types and Type Aliases Learn Kotlin function types: (A) -> B syntax, nullable and suspend types, function types with receivers, typealias, fun interface and SAM conversion, with runnable examples.

Collections

  1. 32 Collections Overview A tour of Kotlin collections: List, Set and Map, read-only vs mutable interfaces, creation functions, the Iterable hierarchy, copies and views, with runnable examples.
  2. 33 Lists Learn Kotlin lists: listOf and mutableListOf, indexing, getOrNull, subList, sorting, binarySearch, removing elements safely, destructuring and common mistakes, with runnable code.
  3. 34 Sets Learn Kotlin sets: setOf and mutableSetOf, removing duplicates, LinkedHashSet vs HashSet vs sorted sets, union, intersect, subtract, equality rules and common pitfalls, with runnable code.
  4. 35 Maps Learn Kotlin maps: mapOf and mutableMapOf, safe lookups, getOrPut, iterating entries, filtering, merging, counting with groupingBy, sorting and LinkedHashMap vs HashMap, with runnable code.
  5. 36 Arrays Learn Kotlin arrays: arrayOf, Array(n) { }, IntArray and other primitive arrays, fixed size, contentToString, copyOf, equality, 2D arrays, vararg interop and arrays vs lists, with runnable code.
  6. 37 Collection Transformations Learn Kotlin collection transformations: map, filter, mapNotNull, flatMap, zip, associate, groupBy, partition, chunked and windowed, with runnable examples, pitfalls and performance notes.
  7. 38 Aggregates and Folding Learn Kotlin aggregate functions: sum, count, min, max, average, sumOf, fold, reduce, runningFold, joinToString and groupingBy, with empty-collection pitfalls and overflow traps.
  8. 39 Sorting and Comparators Learn Kotlin sorting: sorted, sortedBy, sortedWith, compareBy, thenBy, Comparator, Comparable, null ordering, stable sorts and in-place sort versus copy, with runnable examples.
  9. 40 Accessing and Searching Learn how to read and search Kotlin collections: first, last, find, getOrNull, take, drop, slice, indexOf, any, all, none and the exceptions that first() and single() can throw.
  10. 41 Mutable Collections and Iterators Learn Kotlin mutable collections: add, remove, removeAll, retainAll, removeIf, ListIterator, ArrayDeque, read-only views versus copies, and how to avoid ConcurrentModificationException.
  11. 42 Sequences Learn Kotlin sequences: lazy evaluation, asSequence, generateSequence, the sequence builder with yield, intermediate versus terminal operations, and when sequences beat lists.
  12. 43 Pairs, Triples and Destructuring Learn Kotlin Pair and Triple, the to function, destructuring declarations, componentN functions, underscores for unused values and looping over maps, with runnable examples.

Classes and Objects

  1. 44 Classes and Properties Learn Kotlin classes: primary constructors, val and var properties, custom getters and setters, backing fields, init blocks, member functions and common mistakes, with runnable code.
  2. 45 Constructors Learn Kotlin constructors: the primary constructor, default and named arguments, secondary constructors with this(), init order, private constructors and factory functions, with runnable code.
  3. 46 Visibility Modifiers Learn Kotlin visibility modifiers: public by default, private, protected and internal, top-level and file-private declarations, restricted setters and the exposure rules, with runnable examples.
  4. 47 Inheritance Learn Kotlin inheritance: classes are final by default, open and override, calling super, superclass constructors, overriding properties, polymorphism and the open-member-in-constructor trap.
  5. 48 Interfaces Learn Kotlin interfaces: abstract members, default implementations, properties, implementing several interfaces, resolving conflicts with super, fun interfaces and when to prefer them.
  6. 49 Abstract Classes Learn Kotlin abstract classes: abstract members, constructors and state, the template method pattern, and when to choose an abstract class over an interface, with runnable code.
  7. 50 Data Classes Learn Kotlin data classes: generated equals, hashCode, toString, copy and componentN, destructuring, requirements, shallow copies, data objects and when not to use them.
  8. 51 Enum Classes Learn Kotlin enum classes: constants with properties and methods, entries, valueOf, ordinal, abstract members per constant, exhaustive when, EnumMap and enum pitfalls.
  9. 52 Sealed Classes and Interfaces Learn Kotlin sealed classes and sealed interfaces: closed hierarchies, exhaustive when without else, modeling results and UI states, rules for subclasses, and sealed vs enum.
  10. 53 Objects and Companion Objects Learn Kotlin object declarations, singletons, companion objects, factory functions, const val, object expressions and how they replace Java static members, with runnable code.
  11. 54 Nested and Inner Classes Learn the difference between Kotlin nested and inner classes, this@Outer, local classes and anonymous objects, plus memory-leak pitfalls and when to nest, with runnable code.
  12. 55 Value Classes Learn Kotlin value classes: wrap an Int or String in a distinct type with no runtime cost, validate in init, know the restrictions, boxing rules and when to choose them.
  13. 56 Delegation Learn Kotlin delegation: implement interfaces with by, build decorators, use lazy, observable and vetoable properties, store properties in a map and write your own delegate.
  14. 57 Advanced Properties Go deep on Kotlin properties: custom getters and setters, the field keyword, backing properties, lateinit, const val, extension properties and property references with examples.
  15. 58 Equality and Identity Understand Kotlin equality: structural == versus referential ===, writing equals and hashCode correctly, NaN and arrays surprises, Comparable and why BigDecimal differs.
  16. 59 Object Basics: toString, equals, hashCode Learn the three functions every Kotlin object inherits from Any: write readable toString output, implement hashCode correctly, and avoid mutable-key and cyclic-reference traps.
  17. 60 Encapsulation and Design Design safer Kotlin classes: protect invariants with private setters, private constructors and factory functions, avoid leaking mutable state, and hide implementations behind interfaces.
  18. 61 Delegated Properties: lazy, observable, vetoable, map A complete guide to Kotlin delegated properties: how by works, lazy modes, observable, vetoable, notNull, map delegates, provideDelegate, property references and custom delegates.
  19. 62 lateinit vs lazy Compare Kotlin lateinit and lazy: when each initializes, their rules and errors, isInitialized, thread safety, nullable alternatives, and a simple way to choose between them.

Generics and Types

  1. 63 Generics Learn Kotlin generics: write one function or class that works for many types, use type parameters, upper bounds, nullable type arguments and star projection safely.
  2. 64 Variance: in and out Understand Kotlin variance step by step: why List<Dog> is a List<Animal> but MutableList is not, how out and in work, use-site projections and the Java PECS rule.
  3. 65 Type Erasure and reified Why Kotlin cannot check 'is List<String>' at run time, what type erasure means on the JVM, and how inline functions with reified type parameters bring the type back.
  4. 66 Generic Constraints Learn Kotlin generic constraints: upper bounds, multiple bounds with where, recursive bounds like Comparable<T>, and definitely non-nullable types written T & Any.
  5. 67 The Type System Tour A guided tour of the Kotlin type system: Any? at the top, Nothing at the bottom, nullability as part of the type, platform types, intersection types and smart cast rules.

Idiomatic Kotlin

  1. 68 Kotlin Idioms Learn idiomatic Kotlin: data classes, default arguments, expression bodies, null-handling patterns, collection operations, when, extensions and scope functions, with before-and-after code.
  2. 69 Type-Safe Builders and DSLs Build your own Kotlin DSL: lambdas with receivers, nested builders, operator tricks and @DslMarker, with an HTML builder, a config DSL and the real compiler errors.
  3. 70 Operator Conventions How Kotlin maps symbols like +, [], in, .. and () to functions you can define: plus, get, set, contains, invoke, compareTo, iterator, rangeTo and more, with runnable examples.
  4. 71 Destructuring and Component Functions Go deeper with Kotlin destructuring: how componentN works, custom component functions, destructuring lambda parameters, the underscore, map entries, MatchResult and the pitfalls.
  5. 72 Smart Casts and Contracts Learn when Kotlin smart casts work and when they fail, how require, check and isNullOrEmpty help the compiler, and how to write contracts with returns implies and callsInPlace.
  6. 73 Annotations Use and define Kotlin annotations: @Deprecated, @Suppress, @JvmStatic, @OptIn, targets and use-site targets, retention, reading annotations at run time and building a tiny test runner.
  7. 74 Reflection Overview Understand Kotlin reflection: KClass and ::class, callable and property references, what needs kotlin-reflect, Java reflection as a fallback, dynamic proxies and the cost and risks.
  8. 75 Packages and Imports Learn Kotlin packages and imports - package declarations, import aliases, wildcard imports, default imports, top-level declarations and file organization, with runnable examples and real errors.
  9. 76 Design Patterns in Kotlin Learn how classic design patterns look in Kotlin: singleton with object, factories, builders, observer, strategy and decorator, often shorter than in Java, with runnable code.
  10. 77 Context Parameters Learn Kotlin context parameters: declare implicit dependencies with context(...), supply them with context(x) { }, use them in properties and lambdas, and know the limits.

Error Handling and Resources

  1. 78 The Result Type Learn Kotlin's Result type - runCatching, getOrNull, getOrElse, map, mapCatching, recover, fold, returning Result from functions, and when a sealed class or plain exceptions are better.
  2. 79 require, check and assert Learn Kotlin preconditions - require, check, requireNotNull, checkNotNull, error and assert - when to use each, which exception they throw, and how they enable smart casts. Runnable examples.
  3. 80 Resources and use Learn how Kotlin's use function closes resources safely - Closeable and AutoCloseable, close order, suppressed exceptions, return values, files and readers - with runnable examples.
  4. 81 Custom Exceptions and Error Design Learn to design Kotlin error handling - custom exception classes, sealed exception hierarchies, wrapping causes, translating errors between layers, and choosing exceptions or sealed results.
  5. 82 Debugging and Printing Learn practical Kotlin debugging - println tricks, a reusable dbg helper, readable toString, reading stack traces, stderr vs stdout, and when to switch to a real debugger or logger.

Text, Files and Time

  1. 83 Regular Expressions Learn Kotlin regular expressions - the Regex class, containsMatchIn, find, findAll, matchEntire, groups, named groups, replace with lambdas, split and Regex.escape - with runnable examples.
  2. 84 Text Processing Learn practical Kotlin text processing - split, lines, trim, windowed, chunked, word counts, parsing CSV-like text and Char functions - with runnable examples and common pitfalls.
  3. 85 Files and IO Learn Kotlin file handling with java.io.File - readText, writeText, appendText, useLines, buffered writers, temp files, directories, exceptions and in-memory readers - with runnable examples.
  4. 86 Paths and Files with NIO Learn Kotlin's kotlin.io.path API on top of java.nio - Path, the div operator, createTempDirectory, listDirectoryEntries, walk, copyTo, moveTo, attributes and exceptions - with runnable examples.
  5. 87 Dates, Times and Durations Learn time in Kotlin - kotlin.time Duration, measureTime, TimeSource and TestTimeSource, plus java.time LocalDate, LocalDateTime, Instant, ZonedDateTime, Period, formatting and parsing.
  6. 88 Random and Math Learn Kotlin random numbers and math - kotlin.random.Random with seeds, nextInt ranges, shuffled, random, kotlin.math functions, rounding, floating-point pitfalls, mod and hypot - with runnable examples.
  7. 89 Bits and Bytes Learn Kotlin bit manipulation - shl, shr, ushr, and, or, xor, inv, masks and flags, ByteArray, UByte, HexFormat, toString(radix), Base64 and encoding text to bytes - with runnable examples.
  8. 90 Working with JSON Text Learn how to build, escape and parse JSON text in plain Kotlin - buildString, string escaping, a small recursive parser, sealed JSON values - and when to reach for kotlinx.serialization instead.
  9. 91 StringBuilder and buildString Build strings efficiently in Kotlin: StringBuilder append, insert, delete and reverse, the buildString function, appendLine, Appendable, joinTo, and when concatenation is fine.
  10. 92 kotlinx.serialization Basics Learn kotlinx.serialization: the @Serializable plugin, Json configuration, @SerialName, defaults, nullable fields, sealed polymorphism and how it works, with runnable stand-ins.

Coroutines

  1. 93 Introduction to Coroutines A beginner-friendly introduction to Kotlin coroutines - why waiting is wasteful, suspend functions, launch and runBlocking, how coroutines differ from threads, and how to run them with kotlinx.coroutines.
  2. 94 Suspend Functions Understand Kotlin suspend functions - the suspend keyword, calling rules, sequential code that waits, suspending lambdas, blocking versus suspending, withContext and what the compiler does under the hood.
  3. 95 Coroutine Builders Learn the Kotlin coroutine builders - launch and Job, async and Deferred, runBlocking, coroutineScope, lazy start, awaitAll and joinAll - and how to run independent work concurrently and combine the results.
  4. 96 Structured Concurrency Learn structured concurrency in Kotlin coroutines - parent-child jobs, scopes, how a parent waits for children, cancellation and failure propagation, coroutineScope vs supervisorScope, and why GlobalScope is a trap.
  5. 97 Cancellation and Timeouts Learn how Kotlin coroutine cancellation really works - cooperative checks, isActive, ensureActive, finally blocks, NonCancellable cleanup, withTimeout and withTimeoutOrNull, with runnable examples.
  6. 98 Dispatchers and Coroutine Context Understand Kotlin coroutine dispatchers and CoroutineContext - Default, IO, Main, Unconfined, limitedParallelism, withContext, CoroutineName and how contexts combine, with runnable examples.
  7. 99 Exceptions in Coroutines How exceptions travel through Kotlin coroutines - launch vs async, where try/catch works, CoroutineExceptionHandler, supervisorScope, SupervisorJob and common traps, with runnable examples and real error output.
  8. 100 Channels Learn Kotlin coroutine channels - send and receive, rendezvous and buffered channels, close and for loops, produce, conflated channels, fan-out, fan-in and pipelines, with runnable examples.
  9. 101 Flows Learn Kotlin Flow - the flow builder, collect, cold streams, operators like map, filter and take, error handling with catch, buffer, flowOn, zip, combine and flatMapMerge, with runnable examples.
  10. 102 StateFlow and SharedFlow Learn Kotlin StateFlow and SharedFlow - hot flows, MutableStateFlow as observable state, replay and buffers, tryEmit, stateIn, shareIn and SharingStarted, with runnable examples and common pitfalls.
  11. 103 Shared Mutable State Learn why shared mutable state breaks concurrent Kotlin code and how to fix it with Mutex, atomic classes, thread confinement with limitedParallelism and the actor pattern, with runnable examples.
  12. 104 Testing Coroutines Learn how to test Kotlin coroutines - runBlocking tests, avoiding real delays, injecting time, a hand-made virtual clock, testing flows and cancellation, and how runTest works in a real project.
  13. 105 Threads and Java Concurrency Use threads and the Java concurrency toolbox from Kotlin - thread, ExecutorService, synchronized, atomics, ConcurrentHashMap, CountDownLatch and virtual threads - and learn when coroutines are the better choice.

Testing and Tooling

  1. 106 Testing in Kotlin Learn how to test Kotlin code - kotlin.test and JUnit, assertEquals, assertFailsWith, the arrange-act-assert structure, table-driven tests and a tiny test runner you can run in your browser.
  2. 107 Test Doubles Learn test doubles in Kotlin - dummies, stubs, fakes, spies and mocks, written by hand with interfaces and dependency injection, plus how MockK fits in. Runnable examples for every kind.
  3. 108 Gradle Basics for Kotlin Understand Gradle for Kotlin projects - build.gradle.kts, plugins, dependencies and coordinates, tasks and their dependency graph, source sets and version catalogs, with runnable models of how it works.
  4. 109 Project Structure and Modules Learn how a real Kotlin project is organized: source sets, packages, files, modules, visibility across them, layering and dependency direction, and how libraries are published.
  5. 110 Java Interoperability Learn Kotlin and Java interoperability: calling Java from Kotlin, platform types and nullability, SAM conversion, mapped types, and @JvmStatic, @JvmField, @JvmOverloads, @Throws.
  6. 111 Kotlin on Android A guided tour of Kotlin on Android: why Android is Kotlin-first, Jetpack Compose, the Activity lifecycle, ViewModel with StateFlow and coroutines, with runnable stand-ins.
  7. 112 Kotlin on the Server Learn how Kotlin is used on the server: Ktor and Spring Boot, routing DSLs, middleware, JSON, and coroutines for concurrent requests, with runnable stand-ins and a real loopback HTTP server.
  8. 113 Kotlin Multiplatform Understand Kotlin Multiplatform: targets, source sets, expect/actual, what code to share, Compose Multiplatform, and how to design platform-neutral code with runnable stand-ins.
  9. 114 Kotlin/JS and Kotlin/Native Learn how Kotlin compiles beyond the JVM: Kotlin/JS and Wasm in the browser, Kotlin/Native for iOS and native programs, interop with external, cinterop and suspend functions.
  10. 115 Opt-In, Experimental APIs and Compiler Flags Understand Kotlin opt-in: use @OptIn and @RequiresOptIn, mark your own unstable APIs, and configure compiler flags, language and API versions and the K2 compiler.
  11. 116 Building HTTP Servers and Clients with Ktor Learn how Ktor builds HTTP servers and clients in Kotlin: modules, routing, content negotiation, error handling, the HttpClient and testing, with runnable plain-Kotlin demos.
  12. 117 Spring Boot with Kotlin Use Spring Boot with Kotlin: the plugins, constructor injection, data classes as DTOs, null safety in controllers, configuration properties and suspend functions in WebFlux.
  13. 118 Jetpack Compose Basics Learn Jetpack Compose basics: composable functions, state and recomposition, state hoisting, modifiers and lists, with runnable stand-ins that model how declarative UI works.
  14. 119 Kotlin Performance and Bytecode Understand Kotlin performance: what the compiler generates, boxing of Int and List<Int>, inline functions, sequences vs lists, value classes, how to read bytecode and measure with JMH.
  15. 120 Secure Kotlin Code Write secure Kotlin: validate input at the boundary, avoid injection, handle secrets and passwords safely, compare in constant time and avoid dangerous Java deserialization.
  16. 121 Code Style, ktlint and detekt Learn the official Kotlin coding conventions, how ktlint formats code, how detekt finds code smells, and how to wire both into Gradle and CI, with a mini linter you can run here.

Projects

  1. 122 Project: Expression Calculator Build a calculator in Kotlin step by step - a tokenizer, a recursive descent parser, a sealed syntax tree, an evaluator with clear errors, and small tests, all runnable in your browser.
  2. 123 Project: Command-Line To-Do Manager Build a to-do manager in Kotlin step by step - immutable data classes, a sealed command parser, a repository interface, text persistence and a full interactive loop you can run in your browser.
  3. 124 Project: Bank Account Simulation Build a small bank in Kotlin - a Money value class, accounts that protect their rules, sealed results instead of exceptions for business errors, atomic transfers and an audit log you can verify.
  4. 125 Project: Inventory and Reports Build an inventory report generator in Kotlin - parse CSV text safely, group and total with the collections API, sort with comparators, and print aligned tables, with every step runnable.
  5. 126 Project: A Text Adventure Engine Build a text adventure in Kotlin - describe the world with a type-safe DSL, parse sealed commands, move through a pure state machine and play it with scripted input in your browser.
  6. 127 Project: A Coroutine Pipeline Build a concurrent processing pipeline in Kotlin - producer, parallel workers and aggregator connected by channels and flows, with back-pressure, cancellation and deterministic, testable results.
  7. 128 Project: A JSON Parser Build a complete JSON parser in Kotlin: a sealed value tree, a recursive descent parser with precise error positions, a compact writer, a pretty printer and path queries.

Practice

  1. 129 Kotlin Cheat Sheet A one-page Kotlin cheat sheet with runnable examples: variables, null safety, when, functions, lambdas, classes, collections, strings, errors and coroutines, with links to full lessons.
  2. 130 Common Kotlin Mistakes The Kotlin mistakes professionals see most: nullable calls, !!, platform types, shared mutable state, swallowed cancellation, equality traps and number pitfalls, each with a failing example and the fix.
  3. 131 Kotlin for Java Developers A side-by-side guide for Java developers learning Kotlin: classes, null safety, equality, collections, lambdas, static members, exceptions, interop and a practical migration plan.
  4. 132 Kotlin Interview Questions Forty Kotlin interview questions with clear answers on the language, null safety, functions, classes, collections, coroutines and design, plus runnable examples that prove the tricky ones.
  5. 133 Practice Problems: Collections and Strings Seven interview-style Kotlin exercises on collections and strings: word counts, anagrams, palindromes, run-length encoding, two-sum, brackets and sliding windows, with solutions.
  6. 134 Practice Problems: Coroutines and Flow Seven hands-on Kotlin exercises on coroutines, timeouts, channels, flows, cancellation cleanup and concurrency limits, each with a runnable solution and an explanation.