If constants are the default for the := operator, why the const keyword? #8776
ThatXliner
started this conversation in
General
Replies: 1 comment 2 replies
-
Immutable variables are the default, not constant variables... there's no such thing as a constant variable (those 2 words mean pretty much the opposite).
Immutable variables are initialized at runtime, but cannot be changed afterwards. Mutable variables can be changed as much as you like. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've read the docs (which are super great by the way) which said that constant variables are the default when declaring variables (and assigning). So why do you need "const" if mutability is opt-in?
Beta Was this translation helpful? Give feedback.
All reactions