Create ex4.rs

This commit is contained in:
Carol (Nichols || Goulding) 2015-09-15 20:29:05 -04:00
parent fe7157f4de
commit 662c651c6f
1 changed files with 13 additions and 0 deletions

13
ex4.rs Normal file
View 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),
}
}