erg 0.6.53

The Erg programming language
Documentation
i = if
i! = if!
f! = for!
w! = while!

cond = True
s = i cond:
    do "then block"
    do "else block"
assert s == "then block"

i! cond:
    do!:
        print! "then block!"
    do!:
        print! "else block!"

f! 0..<10, i =>
    print! "i = \{i}"

counter = !10
print! counter
w! do!(not(counter == 0)), do!:
    print! "counter = \{counter}"
    counter.update!(i -> Nat(i - 1))

counter2 = !2
not_zero!() = not counter2 == 0
while! not_zero!, do!:
    print! "aaa"
    counter2.dec!()

ii = 0 + 2 * 3 / 2 ** 2
j = -+1

k = !0
if! ii >= 0:
    do!:
        i = 2
        while! do!(k <= 2), do!:
            print! k
            for! [0, 1], i =>
                print! i + k
            k.inc!()

        match! k:
            0 => print! "zero"
            _ => print! "\{k}"

match! k:
    0 => print! "zero"
    _ => print! "\{k}"

ab = match ["a", "b"]:
    ["a", "a"] -> "aa"
    ["b", "a"] -> "ba"
    ["a", "b"] -> "ab"
    [_, _] -> "other"
assert ab == "ab"

arrs = [[0, 1], [2, 3]]

for! arrs, arr =>
    print! arr
    for! arr, elem =>
        print! elem