I was writing some compose multiplatform and I nee...
# getting-started
c
I was writing some compose multiplatform and I needed to set two mutable variables with same type to same value inline like this:
Copy code
showCaptureDialog, hasBegunCapture = true
Of course that’s not possible, but I was curious, why not? 🤔 Is it because the usecase is rarely used or compiler restrictions ??
d
I found the C programmer ;-) Kotlin just doesn’t have that syntax. I don’t think that’s a bad thing.
k
C programmer? C doesn't have that syntax. Well, I mean this syntax is allowed but it doesn't do what you think it does. C and Java have the syntax
showCaptureDialog = hasBegunCapture = true
- because the
=
operator returns a value. In Kotlin, it doesn't.
d
You are correct. And that is a deliberate decision.