Variables

Variables can have any name which does not start with a number. Underscores are not allowed in variable names. Variables are mutable, and always passed by value to functions.

Shadowing

Shadowing is not allowed.

def main() -> (field):
    field a = 2
    // field a = 3 <- not allowed
    for field i in 0..5 do
        // field a = 7 <- not allowed
    endfor
    return a

Scope

Function

Functions have their own scope

def foo() -> (field):
    // return myGlobal <- not allowed
    return 42

def main() -> (field):
    field myGlobal = 42
    return foo()

For-loop

For-loops have their own scope

def main() -> (field):
    field a = 0
    for field i in 0..5 do
        a = a + i
    endfor
    // return i <- not allowed
    return a