runBlock

inline fun <T> T.runBlock(block: () -> Unit): T

Return the value before run the execution block.

Example:

var value = "Hello"
val blockString = value.runBlock { string += " World" }
blockString // "Hello"
value //Hello World"

Since

1.4.0

See also

run
with
apply
let
also