withVariable
inline fun <V : ExpressionValue, R : ExpressionValue> withVariable(name: String, value: Expression<V>, block: (Variable<V>) -> Expression<R>): Expression<R>(source)
Binds expression value to a Variable with the given name, which can then be referenced inside the block using use. For example:
val result = withVariable("x", const(5)) { x ->
x.use() + const(3)
}
Content copied to clipboard