fn main() { let x = 5; let y = { let inner = x * 2; inner + 1 // no semicolon: this is the block's value }; println!("x = {}, y = {}", x, y); // `inner` is not accessible here; it went out of scope }
Click Run to execute this code.