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

IS IT POSSIBLE TO STOP A LOOP? with a line like return or something?

Asked by 6 years ago

So I have while true do scripts and also for i = x, x, x scripts. How would I put an end to the loop if a condition is met?

like if there's a number value that reaches a certain number the loop stops? Please help.

If its possible i would like a example.

3 answers

Log in to vote
0
Answered by 6 years ago

break breaks your loops.

local potato = 1


while true do
    potato = potato + 1

    if potato == 10 then
        break
    end
end
0
does break, breaks sit perm? BlackOrange3343 2676 — 6y
0
Yes. the Break statement basicly continues the current thread to the end of the closest loop. RubenKan 3615 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

break breaks a loop, iterator, or function.

It has to be lower-case by the way.

break

return does end a function but not for loops, it's just used for returning a value.

Log in to vote
0
Answered by 6 years ago

Every loop has some sort of an [ending]

This would lead you to the case; how do i stop this? Well, as i said, loops has an ending to it. In several scenarios, one may understand the difficulty of leading loops to its very last point, the greatest way of stopping loops such as a while loop or a for loop to name a few is by simply using the 5-lettered word:

break

Answer this question