Does ROBLOX have a continue statement i'm trying to continue a loop after breaking it

Does ROBLOX have a continue statement i’m trying to continue a loop after breaking it how would I use it?

while wait(0.2) do
if Humanoid.Health <= 0 then
print(“hp”)
break
elseif Humanoid.Health > 0 then
print(“hpup”)
continue
end
end

Yes it does have a continue statement. The following would only print the even numbers. Continue is used to skip the code in that loop, in can’t “Un break” a loop. What exactly are you trying to accomplish, I don’t see a reason to break the loop.

for I = 1, 100 do
      if I % 2 == 1 then
             continue --this loop will end and move on to the next loop
      end
      print(I.." is an even number")
end
4 Likes

Roblox does have continue, but it can’t continue after breaking a loop as breaking a loop will stop the loop for good. Like you example, if the health of the humanoid is ever 0, it will stop the loop completely, meaning the loop will never run again

1 Like

You don’t have to use a continue statement. If you want continue the loop, you have not to write a statement.

while wait(0.2) do
    if Humanoid.Health <= 0 then
        print(“hp”)
        break
    elseif Humanoid.Health > 0 then
        print(“hpup”)
    end
end

never used continue or needed to this far but I believe it skips the rest of the code when used in a loop and continues the loop for anyone seeing this.

while true do
      if something then continue end
      -- if something wasn't "true" then this code right here would run otherwise it will reloop and try again
       task.wait(.25)
end