never
No normal return and no value domain.
These examples describe the Development language contract. They are not a claim that every workflow is supported by the current public preview. Declaration excerpts belong inside a function unless a full module is shown.
Meaning
never describes a computation that cannot return normally. It has no ordinary values or numeric range. A void function returns with no result; a never function does not return to its caller at all.
fn Stop() -> never {
panic;
}Termination and cleanup
panic is a nonrecoverable fatal trap. It does not unwind and skips pending defer cleanup. A never annotation is a control-flow contract, not an exception or recoverable Result. An ordinary return from a never function contradicts that contract.
fn Require(Ready: bool) -> void {
if !Ready { panic; }
}
// Rejected: fn Broken() -> never { return; }Use in an error path
A never-returning error path lets other paths produce their ordinary result. The failure path cannot manufacture a valid value merely by being marked never. Native no-return declarations also need their foreign ABI contract.
fn Divide(A: i32, B: i32) -> i32 {
if B == 0 { panic; }
return A / B; // Other integer traps still apply.
}See all primitive types and literals and user-defined suffixes.