Lua repeat…until cycle
In Lua
programming language repeat...until
, a loop statement is different from for
and while
cycle for
and while
, the conditional statement of the loop is judged at the beginning of the execution of the current loop, while repeat...until
conditional statement of the loop is judged after the end of the current loop.
Grammar
In Lua
programming language repeat...until
circular syntax format:
repeat
statements
until( condition )
We notice that the loop condition judgment statement condition
at the end of the loop body, so the loop body executes once before the condition is judged.
If the conditional judgment statement ( condition
) for false
the loop restarts execution until the conditional statement ( condition
) for true
will stop the execution.