Operators & Expressions
10.1 Operator table (highest to lowest precedence)
x[i], x.attr, f() Subscript, attribute, call Await a signal or coroutine x is Type, x as Type Type test, cast Negation, identity
Multiply, divide, remainder (also string formatting with %) Add/concatenate, subtract in, not in
Containment (arrays, dictionaries keys, strings) Boolean AND (short-circuit) Boolean OR (short-circuit) a if cond else b
10.2 Examples
Comparing different types with == (e.g., 1 == "1") is an error in typed code and false/error at runtime — keep types consistent.
Division by zero for ints is a runtime error; for floats it yields INF or NAN.
There is no ++/--; use += 1.
var damage := base * 2 if is_critical else base
var alive := hp > 0 and not is_stunned
var mask := 1 << 3 # 8
var has_fire := (flags & Element.FIRE) != 0
flags |= Element.WATER
var v := Vector2(1, 2) * 3 # component-wise scaling
var w := Vector2(1, 2) * Vector2(2, 2)
var joined := "Level " + str(3) # String + int is an error; convert first
if item in inventory: pass
if "hp" in stats: pass