Functions
Functions let you organize your code into reusable blocks. In StellarTrails, you define a function using the fn
keyword.
Defining a Function
fn add(a: Int, b: Int): Int {
return a + b
}
Calling a Function
let result = add(2, 3)
print(result) # Output: 5
Return Values
The return
statement sends a value back from the function.
Next: Control Flow