[Proposal] read-only/immutable local declarations #8259
-
Many times, we declare a variable so we can re-use the result, but we don't intend to ever change or overwrite that result. Sometimes we may accidentally do something to change it which can result in bugs. If we don't intend to change the value, it makes sense to be able to declare it as immutable at a local level. This would then give us compiler errors if we try to reassign it. This is common in other languages too. Kotlin > Val |
Beta Was this translation helpful? Give feedback.
Answered by
TahirAhmadov
Jul 1, 2024
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
333fred
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#188