while Loop

The while loop executes its body repeatedly as long as the condition evaluates to a truthy value.

while condition do
    # body
end

The do keyword is required after the condition. The block is closed with end.

Example

var i = 0
while i < 10 do
    Data.output = Append(Data.output, i)
    i += 1
end

Condition Evaluation

The condition is checked before each iteration. If the condition is falsy on the first check, the body never executes. See Truthiness for the rules on which values are truthy.

Resource Limits

The host environment enforces a maximum iteration count. An infinite loop or excessively long-running loop will be terminated by the runtime.


Back to top

Copyright © Mesch Systems 2025-2026. All rights reserved.