Skip to content

Latest commit

Β 

History

56 Commits

Folders and files

Repository files navigation

Learn Kotlin Programming

A beginner-friendly introduction to the Kotlin programming language. If you have no programming background, start here β€” the lessons begin from the very first line of code.

The examples use current Kotlin idioms, English comments, and a Gradle build on Kotlin 2.4.20 (K2 compiler) with JDK 21.

Requirements

  • JDK 21 or newer (the Gradle toolchain can download one automatically)
  • No local Gradle install is required; use the wrapper

Build and test

./gradlew compileKotlin
./gradlew test

Run the lessons

./gradlew run                  # Hello World (default)
./gradlew runHelloWorld
./gradlew runVariables
./gradlew runLoops
./gradlew runFunctions

You can also run any lesson by file name (without .kt):

./gradlew runLesson -Plesson=Variables
./gradlew runLesson -Plesson=When

Open the project in IntelliJ IDEA or Android Studio and run the main() function in any lesson file.

Lessons (2026 fundamentals track)

All lesson sources and Gradle task names use English identifiers. Sample output may include Turkish place names or phrases for learners.

Lesson Source Gradle task Topics
Hello World HelloWorld.kt runHelloWorld Entry point, println / print
Variables Variables.kt runVariables var, val, type inference
Data types DataTypes.kt runDataTypes Numeric types, Char, String, Boolean
String String.kt runString Concatenation, iteration, trim, case, split
Type conversions TypeConversions.kt runTypeConversions toInt, toIntOrNull, explicit casts
Loops Loops.kt runLoops while, for, ranges, break / continue, repeat
When When.kt runWhen when statement and expression, type checks
Functions Functions.kt runFunctions Parameters, defaults, single-expression functions, vararg
Map Map.kt runMap Read-only and mutable maps, keys and values
Arrays Arrays.kt runArrays arrayOf, IntArray, indices
Lists / ArrayList ArrayList.kt runArrayList listOf, mutableListOf, list operations
Set Set.kt runSet setOf, uniqueness, set statistics
HashSet HashSet.kt runHashSet hashSetOf, set algebra

Why learn Kotlin?

  1. Open source β€” compiler, IDE plugins, and build tools are open source.
  2. Interoperable β€” designed to work with Java and Android codebases.
  3. Concise β€” less boilerplate than Java for the same ideas.
  4. Tool-friendly β€” developed by JetBrains (IntelliJ IDEA, Android Studio).
  5. Null safety β€” the type system helps you avoid null-pointer mistakes.
  6. Multiplatform β€” share logic across Android, iOS, server, desktop, and web targets.
  7. Modern toolchain β€” Kotlin 2.x uses the stable K2 compiler by default.

Project layout

src/main/kotlin/     Lesson sources (one file per topic)
src/test/kotlin/     Smoke tests for selected lessons
gradle/              Version catalog and wrapper

Resources

Support

If this project helps you, you can buy me a coffee.

License

This project is licensed under the MIT License.