summaryrefslogtreecommitdiff
path: root/exercises/ex4.rs
blob: 362a557045097da05c481fb6a1f9831dbc6671c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// ex4.rs
// Make me compile!

fn something() -> Result<i32, std::num::ParseIntError> {
    let x:i32 = "3".parse();
    Ok(x * 4)
}

fn main() {
    match something() {
        Ok(..) => println!("You win!"),
        Err(e) => println!("Oh no something went wrong: {}", e),
    }
}