Skip to content

No return

Chung Leong edited this page Feb 11, 2024 · 4 revisions

noreturn is not a real type in Zig, as it's logically impossible to create an actual instance. It is used to indicate that a function never returns. Such functions are ignored by Zigar.

pub fn panic() noreturn {
    @panic("Wife discovered porn collection");
}
import { panic } from './noreturn-example-1.zig';

console.log(panic);
import module from './noreturn-example-1.zig';

console.log(module.panic);
undefined
Clone this wiki locally