OxL Reference

§6. Functions, effects, errors

In this chapter

6.1 Function declarationWithout -> T the return type is () (for private functions with a body => e the type is inferred from e).
6.2 EffectsThe set of effects is written after the return type, comma-separated
6.3 Calling suspendable functionsA call of a suspendable function in statement position or in an ordinary expression executes immediately; the current task waits for the result (implicit await).
6.4 Returnreturn e terminates the function.
6.5 ErrorsThere are no exceptions.
6.6 PanicCauses: overflow, division by zero, out-of-bounds access, x!
6.7 Contractsrequires is checked on entry, ensures on exit (result is the return value, old(e) is the value of e on entry), invariant (§4.2) — after construction and after var fn.

See also

Source: docs/spec/oxl-standard.en.md