From d7ad057a7b2023b6dfab4638c8d940ab73c1cb21 Mon Sep 17 00:00:00 2001 From: leemckeeman Date: Mon, 28 Oct 2024 13:36:09 -0500 Subject: [PATCH] Update null-safety.md This example is demonstrating a compound predicate for a check of a nullable. In the if body, a property of the non-null value is printed, and in the else a fallback message is printed. The comments on this example were switched. --- docs/topics/null-safety.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/topics/null-safety.md b/docs/topics/null-safety.md index eb4fc33f34b..73dad71ecff 100644 --- a/docs/topics/null-safety.md +++ b/docs/topics/null-safety.md @@ -156,10 +156,10 @@ fun main() { // Checks for nullability first and then accesses length if (b != null && b.length > 0) { print("String of length ${b.length}") - // Provides alternative if the condition is not met + // String of length 6 } else { print("Empty string") - // String of length 6 + // Provides alternative if the condition is not met } //sampleEnd }