+
+```kotlin
+
+fun main() {
+//sampleStart
+ fun getNullableLength(ns: String?) {
+ println("for \"$ns\":")
+ ns?.run { // 1
+ println("\tis empty? " + isEmpty()) // 2
+ println("\tlength = $length")
+ length // 3
+ }
+ }
+ getNullableLength(null)
+ getNullableLength("")
+ getNullableLength("some string with Kotlin")
+//sampleEnd
+}
+```
+
+
+
+
+1. Calls the given block on a nullable variable.
+2. Inside `run`, the object's members are accessed without its name.
+3. `run` returns the `length` of the given `String` if it's not `null`.
diff --git a/examples/06_stdlib/02_withFunction.md b/examples/06_scope_functions/03_with.md
old mode 100755
new mode 100644
similarity index 70%
rename from examples/06_stdlib/02_withFunction.md
rename to examples/06_scope_functions/03_with.md
index 6d5a3e9..d4e2b0c
--- a/examples/06_stdlib/02_withFunction.md
+++ b/examples/06_scope_functions/03_with.md
@@ -1,6 +1,8 @@
+
+
# with
-*with* function lets you access members of an object in a short and concise way. Inside the `with` block you can refer to object members without specifying its name as a prefix.
+`with` is a non-extension function that can access members of its argument concisely: you can omit the instance name when referring to its members.
diff --git a/examples/06_scope_functions/04_apply.md b/examples/06_scope_functions/04_apply.md
new file mode 100644
index 0000000..500346e
--- /dev/null
+++ b/examples/06_scope_functions/04_apply.md
@@ -0,0 +1,32 @@
+# apply
+
+`apply` executes a block of code on an object and returns the object itself. Inside the block, the object is referenced by `this`.
+This function is handy for initializing objects.
+
+
+
+```kotlin
+data class Person(var name: String, var age: Int, var about: String) {
+ constructor() : this("", 0, "")
+}
+
+fun main() {
+//sampleStart
+ val jake = Person() // 1
+ val stringDescription = jake.apply { // 2
+ name = "Jake" // 3
+ age = 30
+ about = "Android developer"
+ }.toString() // 4
+//sampleEnd
+ println(stringDescription)
+}
+```
+
+
+
+
+1. Creates a `Person()` instance with default property values.
+2. Applies the code block (next 3 lines) to the instance.
+3. Inside `apply`, it's equivalent to `jake.name = "Jake"`.
+4. The return value is the instance itself, so you can chain other operations.
diff --git a/examples/06_scope_functions/05_also.md b/examples/06_scope_functions/05_also.md
new file mode 100644
index 0000000..f07367c
--- /dev/null
+++ b/examples/06_scope_functions/05_also.md
@@ -0,0 +1,32 @@
+# also
+
+`also` works like [`apply`](04_apply.md): it executes a given block and returns the object called.
+Inside the block, the object is referenced by `it`, so it's easier to pass it as an argument.
+This function is handy for embedding additional actions, such as logging in call chains.
+
+
+
+```kotlin
+data class Person(var name: String, var age: Int, var about: String) {
+ constructor() : this("", 0, "")
+}
+
+fun writeCreationLog(p: Person) {
+ println("A new person ${p.name} was created.")
+}
+
+fun main() {
+//sampleStart
+ val jake = Person("Jake", 30, "Android developer") // 1
+ .also { // 2
+ writeCreationLog(it) // 3
+ }
+//sampleEnd
+}
+```
+
+
+
+1. Creates a `Person()` object with the given property values.
+2. Applies the given code block to the object. The return value is the object itself.
+3. Calls the logging function passing the object as an argument.
diff --git a/examples/06_stdlib/00_description.md b/examples/06_stdlib/00_description.md
deleted file mode 100755
index ae10ef8..0000000
--- a/examples/06_stdlib/00_description.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Standard Library
-
diff --git a/examples/06_stdlib/01_letFunction.md b/examples/06_stdlib/01_letFunction.md
deleted file mode 100755
index 8ab3b09..0000000
--- a/examples/06_stdlib/01_letFunction.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# let
-
-`let` function allows you to call a specified functional block on an object. This function is useful for scoping and null-checks.
-
-
-
-```kotlin
-fun main() {
-
- fun checkStringContent(ns: String?) {
- println("for \"$ns\":")
-
- ns.let { // 1
- println("\tcontent: " + it) // 2
- }
- }
-
- checkStringContent(null)
- checkStringContent("")
- checkStringContent("some string with Kotlin")
-
- fun checkNullableString(ns: String?) {
- println("for \"$ns\":")
-
- ns?.let { // 3
- println("\tis empty? " + it.isEmpty())
- println("\tcontains Kotlin? " + it.contains("Kotlin"))
- }
- }
- checkNullableString(null)
- checkNullableString("")
- checkNullableString("some string with Kotlin")
-}
-
-```
-
-
-
-1. Defines a code block to execute on `ns`.
-2. Inside the curly braces `ns` is accessible by the name `it`.
-3. Uses a null-safe call, so `let` and its code block are executed only on non-null values.
-
-`let` can also be called on a result of another function execution:
-
-
-
-```kotlin
-fun getStringOfLength(l: Int) = ".".repeat(l)
-
-fun main() {
- fun checkString(l: Int) {
- val empty = getStringOfLength(l).let {
- println("\"$it\" is empty: ${it.isEmpty()} ") // 1
-
- }
- }
-
- checkString(0)
- checkString(1)
-}
-
-```
-
-
-
-1. Here `it` is the result of the `getStringOfLength(l)` call.
\ No newline at end of file