Kotlin
Core Kotlin syntax.
Declarations
val x = 1- Immutable value
var y = 2- Mutable variable
fun add(a: Int, b: Int) = a + b- Function
data class User(val name: String)- Data class
val s: String? = null- Nullable type
Null & flow
s?.length- Safe call
s ?: "default"- Elvis operator
when (x) { 1 -> ... else -> ... }- When expression
for (i in 0..9)- Range loop
list.map { it * 2 }- Lambda with it
Coroutines
suspend fun load()- Suspending function
launch { ... }- Fire and forget
async { ... }.await()- Concurrent result
withContext(Dispatchers.IO) { }- Switch dispatcher