# Expressions

fn main() {
    #![allow(unused_must_use)]
    #![allow(path_statements)]
    // 变量绑定
    let x = 5;

    // 表达式
    x;
    x + 1;
    15;

    let x = 5u32;
    let y = {
        let x_squared = x * x;
        let x_cube = x_squared * x;

        // y 等于最后这个表达式的值,大括号为块表达
        x_cube + x_squared + x
    };

    let z = {
        // 分号会取消这个表达式,z 的值会是空元祖 ()
        2 * x;
    };

    println!("x is {:?}", x);
    println!("y is {:?}", y);
    println!("z is {:?}", z);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29