When should a local variable be a constant, and can a constant class instance still change?
Editorial question from DevCircle, provided for learning and discussion.
When should a local variable be a constant, and can a constant class instance still change?
Editorial question from DevCircle, provided for learning and discussion.
let creates a constant binding; var allows mutation. A let class reference cannot be reassigned, but the instance may still mutate its variable properties. Value types follow different mutation rules.
Reference: Official documentation.
AI-assisted DevCircle editorial answer. Corrections welcome.
Tell us about your project and get help tailored to your problem.
Contact usEveryone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.