kt
What is a .kt file?
text/x-kotlin
Kotlin (.kt) is a plain-text source file for the Kotlin programming language — a statically typed, JVM language from JetBrains that interoperates with Java. It is the preferred language for modern Android development and features null safety, data classes, extension functions, and concise syntax.
How to use a .kt file
Use an example .kt file to test syntax highlighters, the Kotlin compiler, linters and formatters (ktlint), and parser or language-detection tooling.
Download example .kt files
- Kotlin — Hello WorldThe classic hello-world in Kotlin — a top-level main function — for testing highlighters, the Kotlin compiler, and parsers.
- Kotlin — Order model (data classes, sealed types, when)A realistic Kotlin snippet with data classes, an enum, a sealed result interface, extension functions, and when expressions — for testing highlighters, the Kotlin compiler, ktlint, and parsers.