Merge pull request #317 from skondgekar/master

Updated solution
This commit is contained in:
Sunface 2022-11-07 08:29:32 +08:00 committed by GitHub
commit 1a5bdaaf77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -24,11 +24,12 @@ fn main() {
```rust ```rust
fn main() { fn main() {
let x: i32 = 10; let x: i32 = 10;
let y: i32 = 20;
{ {
let y: i32 = 5; let y: i32 = 5;
println!("The value of x is {} and value of y is {}", x, y); println!("The value of x is {} and value of y is {}", x, y);
} }
println!("The value of x is {}", x); println!("The value of x is {} and value of y is {}", x, y);
} }
``` ```
@ -81,14 +82,16 @@ fn main() {
fn main() { fn main() {
let mut x: i32 = 1; let mut x: i32 = 1;
x = 7; x = 7;
// shadowing and re-binding // Shadowing and re-binding
let x = x; let mut x = x;
// x += 3; x += 3;
let y = 4; let y = 4;
// shadowing // Shadowing
let y = "I can also be bound to text!"; let y = "I can also be bound to text!";
println!("Success!");
} }
``` ```