kotlin uses both syntaxes
# random
e
kotlin uses both syntaxes
u
evanchooly: I did't try 1.1.2, but in 1.1.1 or lower
fun test() -> Unit
and
val test = fun() -> Unit
don't compile with error
function must have a body
e
the -> is for lambdas. the = is for functions.
u
I know. But why it different in lambdas and functions? I want to know what's the reason. Is there any notes from kotlin devs on their chooses?
e
i don't know for sure but I'd guess consistency with existing languages. also
=
is always assignment so use
->
for lambda params is a clear disambiguation
u
Thanks. I'll try to google again.