Skip to content
All guides

learn

Arrays and lists

A ledger is a sequence of amounts. […] is a growable list.

fn main() {
    tx = [5000, -1200, 300]
    tx.push(80)
    println(tx[0])
    for n in tx {
        println(n)
    }
    names = ["a", "b"]
    println(names[0])
}

Index with tx[i]. Grow with tx.push(v). Walk with for x in tx. Text lists work the same. Maps are { "k": v } — see stdlib.

Next: walk the array and add: loops.