rust-practice/examples/variables_shadow.rs
2020-07-08 18:32:23 +10:00

11 lines
275 B
Rust

/*
* 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);
}