Version: 1.1.0

Identifiers and keywords

Keywords are reserved. Identifiers are the names you invent.

Essentials

  • An identifier starts with a letter or underscore and continues with letters, digits, or underscores.
  • Keywords such as def, struct, trait, var, fn, alias, comptime, and raises cannot be names.
  • A trailing underscore is the escape hatch when you must match a keyword.
  • Public names are lowercase with underscores. Types use capitalized words.
  • Arguments can be keyword-only after a *.

Example

struct Table:
    var columns: Int

def main():
    var table = Table(3)
    print(table.columns)

Keep in mind

Match the standard library's spelling. A project that invents a second convention is harder to read.