context

Runs the specified block with the given value in context scope.

inline fun <T, R> context(with: T, block: context(T) () -> R): R(source)
fun main() {
    val doubled = context(5) {
        this * 2
    }
    println(doubled)  // Prints: 10
}

Source