User:Anaminus/break nutshell

From Legacy Roblox Wiki
Jump to navigationJump to search

'break' in a nutshell.

'break': ends a 'while' loop or 'repeat' loop.

Example:

while true do 
wait() 
print("loop") 
break 
end

'loop' will print in the output. Note that it appears once.


Another example:

v = 0 
while true do 
wait() 
print("loop") 
v = v + 1 
if v > 3 then 
break 
end 
end 

'loop' will print in the output.

'loop' will print in the output.

'loop' will print in the output.