Syntax & structure
Program structure
A Munos script executes from the top of the file downward. There is no main function and no explicit entry point.
var score = 0
print(score)Top-level statements run in source order. Top-level var declarations are script-wide globals. function, event, struct, and client / server declarations are not executed in place — they're registered (see Functions, Events, and Client & server).
Statements
A statement is one of:
- a
varorconstdeclaration - an assignment (
x = …) - a function call (
foo(…)) - an
if/while/for break,continue, orreturn- a top-level
function,event,struct,client, orserverdeclaration
A bare expression is not a statement. Lines like 6 + 6, x == y, or !flag don't form a valid program. Only function calls — which can have side effects — are an expression form that can stand alone.
Line termination
Statements are terminated by newlines. There are no required semicolons — one statement per line.
var x = 1
var y = 2
foo()A semicolon ; is an optional, equivalent separator that lets several statements share a line. Redundant ones (leading, trailing, doubled) are harmless.
var x = 1; var y = 2; foo()The one place ; is mandatory and means something different is the for header, where it separates the init/condition/step clauses.
Multi-line continuation
Because a bare expression can't be a statement, a line that isn't yet a complete statement automatically continues onto the next. No backslash or wrapping parentheses needed.
total = a + b +
c + d // trailing operator → continues
var total =
a + b // newline after '=' → continuesThe general rule: a line that parses as a complete statement ends at its newline; one that doesn't is glued to the next line until the parse completes.
Brace placement
A block's opening { may sit on the same line or the next — both same-line and Allman styles work, since a { in block position is unambiguous.
if x > 10 { foo() }
if x > 10
{
foo()
}Comments
// line comment, runs to end of line
var x = 5 // inline
/* block comment
spanning lines */Block comments do not nest.