Scope and execution model

Variables follow lexical blocks. A declaration in an inner block can shadow an outer name, and the outer binding is restored after the block.

Top-level executable statements form the program body, which runs in order when the program starts. Their variables are local to the program body: functions cannot read or change them, so state is passed explicitly, usually as a struct, or kept in a shared variable of the module. Functions can read constants, which are set before the program body runs, as those variables are. cuarzo run builds the program with GCC and runs it.

Expressions are evaluated from left to right: the arguments of a call, the operands of an operator, the elements of array and map literals, and the values of an f-string. In print(len(items), remove_at(items, 0), len(items)) the first len sees the array before the element is removed and the second after. and and or evaluate their right side only when it decides the result.