Closed block0xhash closed 3 months ago
Hi It says here https://rust-book.cs.brown.edu/ch03-01-variables-and-mutability.html that:
if we try to use mut for a variable that is shadowed you will get an error:
mut
however I got a warning instead and the code runs:
~/rustbook/variables$ cargo --version cargo 1.76.0 (c84b36747 2024-01-18) ~/rustbook/variables$ rustc --version rustc 1.76.0 (07dca489a 2024-02-04
The book's snippet is not shadowing spaces, but rather re-assigning to it. Note that there is no let keyword on the second line.
spaces
let
Thanks Will. I get it now
Hi It says here https://rust-book.cs.brown.edu/ch03-01-variables-and-mutability.html that:
if we try to use![image](https://github.com/cognitive-engineering-lab/rust-book/assets/16897613/ddd42518-70ce-48b0-b9b5-24b0e3ebeb72)
mut
for a variable that is shadowed you will get an error:however I got a warning instead and the code runs: