Skip to main content
Helix uses .hx files. It’s indentation-based (like Python), no semicolons, no braces.

Variables

name = "Alex"
age = 25
pi = 3.14
active = true
nothing = null
Variables have no type annotations — types are inferred at runtime.

Types

TypeExampleNotes
string"hello"Single or double quotes
number42, 3.14All numbers are floats internally
booleantrue, false
nullnullAbsence of value
list[1, 2, 3]Ordered collection
dict{"key": "value"}Key-value pairs
functionfunction greet(name)First-class functions
nativedatabase.open("app")Objects from modules

String Interpolation

Use {variable} inside strings:
name = "World"
print("Hello, {name}!")
# Output: Hello, World!

config = {"port": 8080}
print("Port: {config.port}")

Functions

function greet(name)
    print("Hello, {name}!")

greet("Alex")
Functions return the last expression. return keyword is also supported.
function add(a, b)
    return a + b

result = add(3, 4)

Control Flow

If / Else

x = 10

if x > 5
    print("big")
else if x > 0
    print("small")
else
    print("zero or negative")

Loops

# Iterate over a list
for item in [1, 2, 3]
    print(item)

# While loop
i = 0
while i < 5
    print(i)
    i = i + 1

Concurrency

Helix has native support for asynchronous tasks using the spawn and wait keywords.

Wait

Pause execution without blocking other tasks.
print("Starting...")
wait 2 seconds
print("Done!")

Spawn

Run a block of code in the background (concurrently).
spawn
    wait 1 second
    print("Background task finished")

print("Main task continues")

Operators

OperatorDescription
+Add / concatenate strings
-Subtract
*Multiply / repeat strings
/Divide
%Modulo
==Equal
!=Not equal
< > <= >=Comparison
andLogical AND
orLogical OR
notLogical NOT

Built-in Functions

FunctionDescriptionExample
print(...)Print values with newlineprint("hello", 42)
cleanprint(...)Print without newlinecleanprint("loading...")
len(x)Length of string/list/dictlen([1,2,3])3
str(x)Convert to stringstr(42)"42"
int(x)Convert to numberint("42")42
type(x)Get type nametype(42)"number"

Methods

String Methods

s = "Hello World"
s.lower()       # "hello world"
s.upper()       # "HELLO WORLD"
s.trim()        # removes whitespace
s.split(" ")    # ["Hello", "World"]
s.contains("lo") # true
s.starts_with("He") # true
s.ends_with("ld")   # true
s.replace("World", "Helix") # "Hello Helix"
s.length()      # 11

List Methods

l = [1, 2, 3]
l.length()    # 3
l.append(4)   # [1, 2, 3, 4]
l.pop()       # [1, 2]
l.first()     # 1
l.last()      # 3
l.join(", ")  # "1, 2, 3"

Dict Methods

d = {"name": "Alex", "age": 25}
d.keys()          # ["name", "age"]
d.values()        # ["Alex", 25]
d.has("name")     # true
d.get("name")     # "Alex"
d.get("missing", "default") # "default"

Imports

# Import a module
import math
import http

# Import a file
import "./helpers.hx"

Comments

# This is a comment
name = "Alex" # inline comment