Yeah this is my first project today and i learned a lot which includes: Let and Mut,and shadowing variables

fn main() {
let  counter = 0;
println!("Counter: {}",counter);
let counter = counter + 5;
println!("The new Counter: {}",counter);
let counter = counter + 10;
println!("The newest Counter: {}",counter);
let  counter = counter + 15;
println!("The new Newest Counter: {}",counter);
let _counter = false;
println!("Finished: {}",counter);
let _counter = counter + 1;
}

(Playground)

Output:

Counter: 0
The new Counter: 5
The newest Counter: 15
The new Newest Counter: 30
Finished: 30

Errors:

   Compiling playground v0.0.1 (/playground)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.51s
     Running `target/debug/playground`

2 Likes