Quickstart
This page shows the core Tython style and rules you need to write code correctly.
First Program
Mental Model
- Declare every name before use.
- Choose mutability at declaration time:
const= cannot be reassignedvar= can be reassigned- Use explicit lexical blocks.
- Avoid shadowing and implicit behavior.
Syntax Highlights
- Lowercase literals:
true,false,none - Typed list annotations:
str[],int[],Fish[] - Explicit blocks with braces:
if ... { ... } - Functions use
funckeyword - Records and classes:
recordfor immutable named shapesclassfor stateful behavior withinit+ optionalsetup
Run and Transpile
Run tests:
Run a .ty file (project mode):
Transpile .ty to Python: