Rollup merge of #123849 - JimmyOhn:first_contribution, r=pnkfelix

Update E0384.md

Add an example for the shadowing usage.
This commit is contained in:
Matthias Krüger 2024-04-12 17:41:35 +02:00 committed by GitHub
commit 38283bc295
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,3 +18,16 @@ fn main() {
x = 5;
}
```
Alternatively, you might consider initializing a new variable: either with a new
bound name or (by [shadowing]) with the bound name of your existing variable.
For example:
[shadowing]: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing
```
fn main() {
let x = 3;
let x = 5;
}
```