Set a value
score = 0
score += 10
debug.log(score)
This prints 10. You can give a variable a type:
health: number = 100
name: string = "Ada"
ready: bool = true
Constants
Use const when the variable should not be assigned again.
const max_health = 100
A constant basket can still have its contents changed. Use basket.freeze() to make its contents read-only.
Scope
Top-level variables are available to functions and event handlers in the same script. Function parameters and local variables belong to their function. Separate Module files keep separate state. Actor-attached Modules also keep state for each Actor. See Modules.
No value
Use nil for no value. Check a lookup result before reading its properties. See Finding Objects.