Hi devs,
I got a question today of how do I restart a while loop (Execute the while loop from its beginning) if some conditions are met?
Hi devs,
I got a question today of how do I restart a while loop (Execute the while loop from its beginning) if some conditions are met?
This is what a while loop is for, It loops until the condition is not true.
you can make a while loop inside of function, then trigger the function with needed conditions
if you mean jump back to the start of a while loop, you can use the continue
statement.
1 while true do
2 while true do
3 local command = getCommand()
4 if command == "restart" then continue end -- jumps back to line 2
5 end
6 continue -- jumps back to line 1 (redundant here but im showing jump logic)
7 end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.