KO

Kotlin Coding Conventions

Used in 35 kotlin projects (avg ★16)

Kotlin
Style Guide
Default
Used by 35 projects

Details

Language / Topic
kotlinKotlin
Category
Style Guide
Source
JetBrains

Rules

balanced
- Prefer `val` over `var`.
- Avoid `!!` operator; use safe calls (`?.`) or `let`.
- Use `when` expressions for exhaustiveness.
- Use expression bodies for single-expression functions.
- Follow naming: camelCase for variables/functions, PascalCase for classes.
- Use immutable collections by default to promote immutability.
- Declare nullable types explicitly (`String?`) and handle nulls safely.
- Place parameter comments on a separate line above the parameter.