Results
T ? E, matched with when, unwrapped with ?: and ?.
main (print)
# T ? E is a success value or an error value. Return either directly.
half(n int) int ? str
if n % 2 != 0
"odd"
n / 2
forward(error str) str from error
error
# ?: unwraps or falls back. ? unwraps or returns the handler's value
# from the current function.
quarter(n int) int ? str
h = half(n) ? forward
half(h)
main()
a = half(8) ?: 0
b = half(7) ?: 0
when quarter(12) is
value print.line("{a} {b} {value}")
error print.line("{error}")4 0 3