summaryrefslogtreecommitdiff
path: root/A scope block is an expression.md
blob: 29f6214f25c405faa5413efb135afa30cb81f63c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
[[Rust]]

An expression evaluates to a value. In Rust that can also mean a scope block as follows:
```rust
fn main() {
    let y = {
        let x = 3;
        x + 1
    };

    println!("The value of y is: {y}");
}
```