summaryrefslogtreecommitdiff
path: root/functions/src/main.rs
blob: c7a0db1895e9d7b07d636b0a020be2e805bace88 (plain)
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
fn main() {
    /* basic */
    println!("Hello, world!");

    another_function(5, 6);
    
    /* expression */
    let y = {
        let x = 3;
        x + 1
    };

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

    /* return */
    let x = plus_one(5);

    println!("The value of x is: {}", x);
}

fn another_function(x: i32, y:i32) {
    println!("The value of x is: {}", x);
    println!("The value of y is: {}", y);
}

fn plus_one(x: i32) -> i32 {
    x + 1
}