Multiple returns and assignment
A parenthesized result annotation declares an exact fixed pack:
private function split(value: Int): (Int, String) return value / 2, String(value % 2)endEvery element type and the exact arity are known before HIR. There is no dynamic variadic result, missing-value nil padding, or discarded extra value.
Destructuring a call
Section titled “Destructuring a call”Declare one local for each result:
local quotient: Int, remainder: String = split(9)print(`quotient={quotient}, remainder={remainder}`)Each binding may have its own optional annotation. A mismatch in count or type is a compile-time error.
Swapping values
Section titled “Swapping values”Multiple assignment evaluates every right-hand value before performing stores:
local left = 10local right = 20left, right = right, leftTargets are located left to right, values are evaluated left to right, and stores occur left to right. Effectful receivers and indexes are evaluated once.
Static tuple projection
Section titled “Static tuple projection”A fixed pack can remain one value. Use a one-based literal index to project its exact element type:
local result = split(9)local quotient = result[1]local remainder = result[2]The index must be a positive in-range integer literal. result[index], result[0], and an out-of-range slot are compile-time errors rather than dynamic tuple lookup.
