A Turf file can declare things at its top level – functions, structs, enums, imports, extern bindings, export immut constants – but it can’t do anything there. Statements (a call, an assignment, a variable, a return, an if) must be inside a function.
Example
import io;io::printline("hello"); // a call, outside any functionfn main(): int { return 0; }Move it into main, which is where a program starts:
Example
import io;fn main(): int { io::printline("hello"); return 0;}If a file has statements at the top level because it was meant to be a script, wrap them in fn main(): int { ... return 0; }.
Run turf --explain E118 in a terminal to read this again.