Completed Coursera: Kotlin for developers course

This commit is contained in:
Martin Berg Alstad
2025-07-30 14:34:03 +02:00
committed by Martin Berg Alstad
commit 64d9e4ada7
41 changed files with 608 additions and 0 deletions

10
src/Nullable.kt Normal file
View File

@ -0,0 +1,10 @@
fun main() {
var nullableString: String? = null
println(nullableString?.length ?: 0) // Null safe method call with elvis operator for fallback
nullableString = "Not Null"
println(nullableString)
}
fun nullableFun(value: Any?) {
value!! // Explicitly tell the compilar that it's not null
}