Xo is experimental. The source code is not public yet; it will be soon. Read the release notes
Menu · XO0168

Docs

XO0168: statement (let, expression, ...) at top level

error · reported by the parser

A file holds only use declarations and declarations (fn, struct, enum, interface, type, const, test). Statements such as let, assignments, and expressions are allowed only inside a function or test body. A module level value is a const. See core 15 (File).

Example

let max_users = 10

fn f() -> Int { max_users }

Fix

const MAX_USERS = 10

fn f() -> Int { MAX_USERS }

Run xo explain XO0168 for this text in a terminal, or see section 10.6 of the specification.