Hello all, please consider adding your thoughts in...
# announcements
g
Hello all, please consider adding your thoughts into this issue: https://youtrack.jetbrains.com/issue/KT-43876
r
I think it would be worth adding a use case that shows why you don’t just assign them to the correct value in the first place
But FWIW, typically multi variable declaration is considered poor style in Java, so Kotlin doesn’t allow it; and there’s a fairly strong bias against reassignment in kotlin (favour
val
over
var
), so I’d be surprised if this got much traction. No harm asking though.
g
About the first statement, yes, indeed I have a good example for that. There are some kind of recursive problems, for coding challenges for example, that this kind of behavior is needed.
About the second one I disagree. Actually Java is too old fashionable these days to dictate the way we write code. And the code there is much less about val or var, but more about the possibility of multiple assignments and swapping. Var was used, of course, because the values need to be swapped and because of that the values need to be mutable.