Join Slack
Powered by
In kotlin for now fun <T> T.foo(block:(T)-&g...
# getting-started
s
smit01
11/09/2021, 6:52 AM
In kotlin for now fun <T> T.foo(block:(T)->Unit):Unit = block(this) here type parameter T is nullable why not make it not-nullable implicitly?
a
andylamax
11/09/2021, 7:01 AM
You need to specify explicitly that you need a non nullable
fun <T:Any> T.foo(block: (T)->Unit) = block()
➕ 1
Open in Slack
Previous
Next