Need Assistance?

support@tutorialshub.in

Variables, Data Types & Mutability

Variable Shadowing in Rust

ADVERTISEMENT
Rust Free Lesson
5 min read
ADVERTISEMENT

Shadowing lets you declare a new variable with the exact same name using let again. Unlike mut, shadowing even lets you change the data type (for example, turning a string input "42" into an integer 42) while keeping the final variable immutable!

ADVERTISEMENT
Hi, I'm Tuby! Here to help you