```fun main() { val callback = { i: Int, j: In...
# getting-started
g
Copy code
fun main() {
    val callback = { i: Int, j: Int ->
        val ii = i.times(j)
        val jj = j.times(ii)
        ii + jj
    }

    println(addAndMultiply(5, 6) { i, j ->
        i + 1 + j
    })

    println(addAndMultiply(5, 6, callback))
}

inline fun <T> addAndMultiply(x: T, y: T, call: (T, T) -> T): T where T : Number {
    if (x is BigDecimal || x is BigInteger) return call(x, y)
    if (y is BigDecimal || y is BigInteger) return call(x, y)

    return call(x, y) * x * y
}
I am getting reciever type mismatch at
return call(x, y) * x * y
Any Idea ?
l
I don't think the multiplication, or any arithmetic operator, is defined for Number
👆 2