Variable Scope in Rust



examples/other/scope/src/main.rs
fn main() {
    let fname = "Foo";
    let lname = "Bar";
    println!("{} {}", fname, lname);
    {
        let fname = "Peti";
        println!("{} {}", fname, lname);
    }
    println!("{} {}", fname, lname);
}

Foo Bar
Peti Bar
Foo Bar