I’m making a break
inside of an if statement, inside of a repeat loop, inside of a while true do loop. So I was wondering, will this break
break the repeat loop, while true do loop, or both? I want it to only break the repeat loop as I have other stuff in the while true do loop. If it breaks both loops, what can I do to make it only break the repeat loop while letting the code continue running the while true do loop?
break
only breaks the innermost loop.
while true do -- 2
while true do -- 1
print(1)
break -- only breaks 1
end
print(2)
wait(2)
end
7 Likes