Error codes

E0031: function header line without clauses

In a terminal: auk explain E0031 prints this page.

On this page

A fn line with no body is a header line (docs, pub, contracts) for the clauses that follow it. Here no clauses follow, or the body-less fn comes after its clauses.

Wrong#

auk
fn double(n: int): int
fn main() { print(1) }

Fixed#

auk
fn double(n: int): int = n * 2
fn main() { print(double(1)) }

Common causes#

  • A forward declaration as in C: Auk doesn't need one; just give the function a body.
  • A forgotten = expr or { ... }.
  • The header written after the clauses: move it above them.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page