§6. Functions, effects, errors
In this chapter
| 6.1 Function declaration | Without -> T the return type is () (for private functions with a body => e the type is inferred from e). |
| 6.2 Effects | The set of effects is written after the return type, comma-separated |
| 6.3 Calling suspendable functions | A 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 Return | return e terminates the function. |
| 6.5 Errors | There are no exceptions. |
| 6.6 Panic | Causes: overflow, division by zero, out-of-bounds access, x! |
| 6.7 Contracts | requires 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