rust-practice/examples/variables_shadow.rs

12 lines
275 B
Rust
Raw Normal View History

2020-07-08 08:32:23 +00:00
/*
* x is defined as an immutable variable, then defined again later (shadowed?)
* redefining a variable like this lets you change the type.
*/
fn main() {
let x = 5;
println!("The value of x is: {}", x);
let x = 6;
println!("The value of x is: {}", x);
}