Variables and assignment

Declarations require a type, name, =, and initializer:

int count = 0

Existing variables can use plain or compound assignment:

count = 5
count += 1
count -= 1
count *= 2
count /= 2

The compiler checks types before emitting C. Unknown variables, redeclarations in the same block, and assignments between incompatible types are rejected. Numeric types (all integer and float types, plus bool) convert implicitly to each other, except that a float never becomes an integer without a conversion; other types must match exactly, except that null is accepted wherever a reference type is expected.

Compound assignment requires a numeric target, except that += also appends to a str variable or field.

An assignment evaluates its target first and its value second: for values[i] = f(), the array and the index are evaluated, then f(), and the element is stored last. This holds even when f() changes the array.

An expression used as a statement must be a call, such as print(x) or push(values, 1). A bare expression like x + 1 on its own line is rejected.