StelLang Keywords
By Mahesh
Here’s a quick reference to the essential keywords in StelLang, with modern examples and explanations.
pub
Marks a function as public (importable):
pub def greet() {
print("Hello!")
}
import
Imports a module or file:
import greet from "./greet.stel"
greet()
def
Defines a function:
def add(a, b) {
return a + b
}
let
Declares a variable:
let x = 10
if / else
Conditional logic:
let x = true
if x {
print("True!")
} else {
print("False!")
}
docstrings
Add documentation to functions:
def foo() {
"""
This is a docstring!
"""
print("Hello!")
}
decorators (EXPERIMENTAL)
Modify or extend function behavior:
def log() {
print("Logging!")
}
@log
def run() {
print("Running!")
}
See the full docs for more language features!