// Exercise 10: Result and ? // `add_strings` should parse both strings and add them. // Use `?` so that a bad number returns the Err. fn add_strings(a: str, b: str) -> Result[i64, str] { let x = a.parse_int() let y = b.parse_int() Ok(x + y) } fn main() { assert(add_strings("2", "40").unwrap() == 42) assert(add_strings("2", "forty").is_err()) print("ok") }