9.3Errors are values
func parse_port(arg: String) -> Result[Int, String]
example "8080" -> Ok(8080)
example "http" -> Err("not a number: http")
match parse_int(arg) with
| Some(n) -> return Ok(n)
| None -> return Err("not a number: " + arg)
end match
end func
Result and Option replace null and unchecked exceptions. The ? operator returns an error early.