Print & Output
The print() function, outputting values, and side effects.
Thagore uses Python-like syntax with indentation-based scoping. Every block is opened by a : and indented. Source files use the .tg extension.
# Import a standard library moduleimport fs
# Define a structstruct Point: x: i32 y: i32
# Implement methods on the structimpl Point: func magnitude(self) -> i32: return self.x * self.x + self.y * self.y
# Define a functionfunc greet(name: String) -> String: return "Hello, " + name + "!"
# Entry pointfunc main() -> i32: let p = Point(3, 4) let mag = p.magnitude() print(mag)
let msg = greet("Developer") print(msg)
let i = 0 while (i < 5): print(i) i = i + 1
return 0Print & Output
The print() function, outputting values, and side effects.
Variables & let
Variable declarations with let, type inference, reassignment, and scope rules.
Functions
Function declarations, parameters, return types, and the main entry point.
Control Flow
if/else, while loops, for..in range loops, and match expressions.
Structs & impl
Struct definitions, method implementations, and operator overloading.
FFI & Import
Module imports, extern func for C FFI, and the module system.
Advanced Features
Enums, match, traits, comptime, defer, unsafe, and closures.
The simplest valid Thagore program:
print("Hello!")Thagore supports top-level statements — if your source has no func main(), the compiler wraps top-level code in an auto-generated main function.
func main() -> i32: print("Hello from main!") return 0