But I see another case where assignment inside of ...
# announcements
g
But I see another case where assignment inside of expression would be helpful. It’s
when
expression with assignment: https://youtrack.jetbrains.com/issue/KT-4895 There is a big dissussion and looks like assignment inside
when
is the best proposal imho. Probably, if Kotlin team decide to implement this for
when
it would make sense to do also for
if
m
I would use that many times already if it’d exist:)
g
Yes, exactly. Case with
when
looks like much more common and important than
guard
for
if
m
Especialy when using
Copy code
fun test () = when () {}
syntax:)
g
But for when again, I see why this is not really high priority feature. Because you can just create local variable before when
m
I know, it’s just a syntax sugar in this case, that you don’t have use block body
g
yeah