Early this week because last week didn’t happen be...
# feed
d
Early this week because last week didn’t happen because stuff

https://youtu.be/UpFjtTUZoEI

K 3
👏 3
g
that's a cool new feature in
2.2
! is there a way to pass multiple context parameters with something other than multiple nested
with
blocks?
d
Not that I know of, but you could always write your own for 2, 3, 4…
g
I ended up making a context parameters data class, and then passing it to the
with
and using it with
run
, something like:
Copy code
// Define:
data class ContextParams(
    val param1: String,
    var param2: Int
)

context(context: ContextParams)
fun f(): String = context.run {
    return "param1:${param1} param2:${param2}"
}

// Call:
with(ContextParams("string", 1)) {
    println(f())
}
d
👏 1