Variables¶
Variables are assigned with =. No declaration keyword is needed.
Reassignment¶
Variables can be reassigned to any type at any time:
Scope¶
Variables live in the scope where they are assigned. Functions create their own scope. Inner scopes can read variables from outer scopes (closures), but assigning in an inner scope creates a new local variable — it does not modify the outer one.
x = 10
function show() {
write(x) # reads outer x → 10
}
function shadow() {
x = 99 # creates a new local x, does not touch outer x
write(x) # 99
}
show()
shadow()
write(x) # still 10
Compound assignment¶
Luz does not have += or -=. Use the full form: