Rust allows redeclaring local variables to great benefit

from blog ntietz.com blog - technically a blog, | ↗ original
↗ original
A lot of programming languages allow variable shadowing in new scopes. Early on, you learn that it can cause errors and can be confusing, but is situationally appropriate sometimes. Something that's less commonly allowed is redeclaring variables to shadow them locally. And when it is allowed, it's often considered bad practice and confusing....