Syntax and literals#

Meta: this page is the boring foundation. Focus on what would surprise someone coming from JS/Go/Python (semicolons-optional, newline-as-separator, # not //, no trailing commas in formatted output). Grammar rules live in Grammar notes.

File layout#

Comments#

Meta: /// doc comments don't exist — docstrings are real triple-quoted strings attached to declarations (covered in Fields and Functions).

Identifiers#

Reserved words#

Separators and trailing commas#

Literals#

Meta: one short subsection per literal kind, with one example each. The three string flavors sit side-by-side so the differences are obvious.

Numbers#

Booleans and null#

String literals#

See Strings for the full method reference.

The three flavors, side by side:

Backtick templates in detail — backticks switch the lexer into template mode:

Lists#

Objects (record literals)#

Meta: explicitly call out the double-brace syntax — it's the unusual one and the first reaction is "is that a typo?"