Skip to content
Quiz · Variables and Types · lesson 4 of 12

Quiz — shadowing in a block

What does the program print (lines separated by spaces)?

Rust
fn main() {
    let x = 5;
    let x = x * 2;
    {
        let x = x + 1;
        println!("{x}");
    }
    println!("{x}");
}