mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 23:10:30 +00:00
Create ex4.rs
This commit is contained in:
parent
fe7157f4de
commit
662c651c6f
1 changed files with 13 additions and 0 deletions
13
ex4.rs
Normal file
13
ex4.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// 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),
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue