Skip to main content
Clarify title (question is not about why support either of two options, but both at once)
Link

Why do some languages have both immutable "variables" and constants?

Removed "rust" tag since although Rust was used as an example, it isn't about Rust specifically.
Link
QAH
  • 341
  • 2
  • 4
Became Hot Network Question
Source Link
QAH
  • 341
  • 2
  • 4

Why do some languages have immutable "variables" and constants?

Some programming languages (Rust is one I can think of off the top of my head) provides mechanisms to have immutable variables but they also have constants. Isn't an immutable variable just a constant? What advantage is there in supporting both?