How to break for loop but not while loop?

So if I have a “for i,v loop” in a “while true do loop”. How would I break the for i,v loop whilst not breaking the while loop:

while true do
    for i,v in example do
    
    break -- this break should only break the for i,v loop
    end
end

Breaking the nested loop doesn’t break the outer loop.

1 Like

It does when I try it._________

Could you please show me what you used? The following loops indefinitely as expected:

local example = {"a", "b", "c", "d", "e"}
while true do
    print("Still in a loop")
    for i, v in example do
        break
    end
    task.wait()
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.