We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6464d2b commit 6a0f9e7Copy full SHA for 6a0f9e7
kotlin-features/safe.md
@@ -12,10 +12,10 @@ fun main() {
12
// println(message.uppercase()) // This line doesn't compile
13
println(message?.replace("fine", "okay")) // Access a nullable value in a safe manner
14
if (message != null) { // If you check that the type is right,
15
- println(message.uppercase()) // the compiler will smart-cast it for you
16
-}
+ println(message.uppercase()) // the compiler will smart-cast it for you
+ }
17
18
-val nonNull: String = // If the null-case throws an error,
+ val nonNull: String = // If the null-case throws an error,
19
reply(condition = true) ?: error() // Kotlin can infer that the result is non-null
20
println(nonNull)
21
}
0 commit comments