3 ms·
For this example of yours: let y = x.let { x -> x + 100 }.apply { x -> println(x) }.let { x -> x * 2 } I think you've
by zbentley 9y ago
For this example of yours:
let y = x.let { x ->
x + 100
}.apply { x ->
println(x)
}.let { x ->
x * 2
}
I think you've just reinvented imperative control flow. Isn't your example just modeling a reusable function that represents a series of instructions on a value?
func(x) {
let y = x + 100
println(y)
let z = y * 2
return z
}