Complete the code to chain two scope functions on the string.
val result = "hello".[1] { println(it.uppercase()) }
The also function returns the original object after applying the block, allowing chaining.
Complete the code to chain let and run to transform and print a string.
val length = "kotlin".let { it.uppercase() }.[1] { println(this) this.length }
The run function executes the block with this as the context and returns the block result.
Fix the error in chaining apply and let to modify and print a mutable list.
val list = mutableListOf(1, 2, 3).[1] { add(4) }.let { println(it) it.size }
apply returns the object after applying changes, allowing let to receive the updated list.
Fill both blanks to chain let and also to transform and print a string.
val result = "scope".[1] { it.uppercase() }.[2] { println(it) }
let transforms the string and returns the result; also prints it and returns the original object.
Fill all three blanks to chain apply, let, and also to modify, transform, and print a list.
val size = mutableListOf(5, 6).[1] { add(7) }.[2] { it.sum() }.[3] { println(it) }
apply modifies the list and returns it; let calculates the sum; also prints the sum and returns it.