Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the difference between the while loop and repeat until loop?

So recently i discovered about the repeat until loop, but i don’t see any use for it because a while loop does the same thing. Can someone explain?

1 answer

✓ Accepted answer

The while loop will repeat the code infinity until u Break it

while true do --Infinity loop
--Do something
wait()
end

The repeat loop will repeat until the until condition is right:

t=0
repeat
wait(1)
t = t+1
until t>= 10 -- Stop when t >= 10

Edit: Here is a wiki about loops

5 comments

0

can’t a while loop do the same? like if you do while x==1 and then you change the value of x inside the loop, that could do the same as a repeat until loop

1

The while loop can rerun if the condition is right while the repeat loop can not rerun

0

thanks

0

No problem :D Make sure to accept if the answer helped you solve your problem !

0

I suggest looking at the wiki.

This discussion is preserved as it was. New answers, comments, and votes are closed.