trpl-zh-cn/listings/ch03-common-programming-concepts/no-listing-03-shadowing/src/main.rs

13 lines
189 B
Rust

fn main() {
let x = 5;
let x = x + 1;
{
let x = x * 2;
println!("The value of x in the inner scope is: {x}");
}
println!("The value of x is: {x}");
}