Jonathan Olsson
12/14/2021, 1:45 PMsuspend
lambdas could be used just like normal lambdas. Why then is this not allowed?:
fun main() {
val f = suspend { i: Long ->
delay(i)
}
runBlocking {
f(1000L)
}
}
hfhbd
12/14/2021, 2:23 PMval f: suspend (Long) -> Unit = { i: Long ->
delay(i)
}
runBlocking {
f(1000L)
}
Jonathan Olsson
12/15/2021, 7:27 AMsuspend
keyword together with a parameterised lambda, the variable needs to be annotated? Contrast with a normal lambda where this is perfectly fine:
val f = { l: Long ->
Thread.sleep(l)
}