while
Loop while the condition is true. There is no do/while.
Syntax
Section titled “Syntax”while (cond) {}Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cond | bool | Checked before each iteration. |
Return value
Section titled “Return value”None.
Luau emit
Section titled “Luau emit”while … do … end
Description
Section titled “Description”There is no continue. Use nested if or restructure. break leaves the loop.
Example
Section titled “Example”while (true) { post("tick"); break;}Emits:
while true do print("tick") breakend