Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can you break or stop a for loop or a while loop?

Asked by 5 years ago

Hello I have a start button that will start a while loop. And I also have a stop button and I want to stop the loop. How can I do that? I can change it to a for loop if it is impossible to stop a while loop. Thanks

1
Please do some research on loops. JesseSong 3916 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You could use this example

1while true do
2    print("Test")
3    break
4end

i know that break breaks a while loop. not sure for loops tho.

Ad
Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
1while true do -- Loop
2    break -- Command to break loop
3end

Answer this question