Skip to content

ZNTC0401: Function declaration is not allowed in statement position

Function declaration is not allowed in statement position

Category: Parser: Declaration/Class

if (true) function foo() {}

Reproduce in Playground →

See the error message for cause and resolution.