← Docs

2 · Control & functions

Branching

if runs the indented block when the condition holds. Add a same-level els block for the false path:

if x > 10
    echo "big"
els
    echo "small"

Conditions support == != < <= > >=, plus bare true / false and any non-zero value as true.

Loops

counter0
lo10                       cmt run the block exactly 10 times
    echo counter
    (counter.counter+1)
running1
val0
lo10w running == 1         cmt up to 10 times, stops when false
    echo val
    (val.val+1)
    if val == 3
        running0

loN is a fixed loop. loNw cond checks the condition each iteration and stops early when it fails (max N iterations — e.g. lo1000w true is the standard game/app loop).

Functions

Define with vectfn name.a, b, return with rtn, call with (target.name args):

vectfn add.a, b
    (sum.a+b)
    rtn sum
vectfn main
    (result.add 25, 75)
    echo result            cmt 100
main()

Plain calls like main() discard the return value. Parameters are bound per call, so recursion works.

Next: 3 · Data & I/O →