From 3c30baae1d3ce68ed1e466a1c8280a7c8fa7b94a Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Sun, 18 Jun 2023 00:15:26 +0200 Subject: [PATCH] Update 01_let.md We don't want to hide the function from the documentation as it confuses the reader --- examples/06_scope_functions/01_let.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/06_scope_functions/01_let.md b/examples/06_scope_functions/01_let.md index 118427c..218019b 100644 --- a/examples/06_scope_functions/01_let.md +++ b/examples/06_scope_functions/01_let.md @@ -4,12 +4,13 @@ The Kotlin standard library function `let` can be used for scoping and null-chec The object is accessible inside the block by the reference `it` (by default) or a custom name. ```run-kotlin +//sampleStart fun customPrint(s: String) { print(s.uppercase()) } fun main() { -//sampleStart + val empty = "test".let { // 1 customPrint(it) // 2 it.isEmpty() // 3 @@ -39,9 +40,8 @@ fun main() { printNonNull(null) printNonNull("my string") printIfBothNonNull("First","Second") -//sampleEnd } - +//sampleEnd ``` 1. Calls the given block on the result on the string "_test_".