I’m trying to be able to run this code:
class test {
fun test() {
MinOreo { print("Oreo and above")}
MinOreo ({print("Oreo and above")},{print("Below Oreo")})
}
}
For this I’ve specified this function:
fun <T> T.MinOreo(block: T.() -> Unit, blockElse: T.() -> Unit = {}) = doForMin(block, blockElse, Api.OREO)
It doesn’t work. The first “MinOreo” block above fails to compile:
No value passed for parameter 'block'
If I add this it then starts to work:
fun <T> T.MinOreo(block: T.() -> Unit) = doForMin(block, {}, Api.OREO)
Shouldn’t it work with the default parameter version of the function alone?
Thanks in advance!