Version: 1.1.0

Basics cheat sheet

The declarations you type most often, on one page.

Essentials

  • def main(): is the entry point.
  • var name: Type = value declares a variable.
  • if, for, and while introduce blocks.
  • struct holds fields. trait holds required methods.
  • Comments start with #. Docstrings are triple-quoted strings.

Example

def main():
    var n = 3
    if n > 0:
        print(n)

Keep in mind

Indent with four spaces. The parser accepts other widths, but tools expect four.