diff options
Diffstat (limited to 'old_curriculum/ex4.rs')
| -rw-r--r-- | old_curriculum/ex4.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/old_curriculum/ex4.rs b/old_curriculum/ex4.rs new file mode 100644 index 0000000..362a557 --- /dev/null +++ b/old_curriculum/ex4.rs @@ -0,0 +1,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), + } +} |
