What's the difference between break and return end in an in pairs loop?

local countlessparts = workspace.CountlessParts:GetChildren()
local count = 0

for i,v in next, countlessparts:GetChildren() do
count += 1
if count >= 4 then
return end
end

and

local countlessparts = workspace.CountlessParts:GetChildren()
local count = 0

for i,v in next, countlessparts:GetChildren() do
count += 1
if count >= 4 then
break
end
end

Would both of them do the same thing or would one of them act differently or something?
Also what’s the difference?
Thank you!

Edit: If you don’t know what in next is, it’s basically the same as in pairs.

1 Like

When you return something, you are exiting a function as a whole. When you use break, you are exiting a for loop, or while loop only.

6 Likes