Syntax Overview
Stellartrails syntax is designed to be clear and concise. Here are some key features:
- Statements end with a newline, not a semicolon (though semicolons are allowed):
let x = 42
let y = 3.14;
let s = "hello"
print(x)
- Indentation is not significant.
- Blocks are defined with curly braces
{}
:
fn add(a: Int, b: Int) -> Int {
return a + b
}
let result = add(2, 3)
print(result)
- Functions are defined with
fn
:
fn greet(name: String) {
print("Hello, " + name)
}
greet("World")
- Comments start with
#
:
# This is a comment
let pi = 3.14159