WHILE


while condition do
	--code to repeat
end
condition a variable or statement that will resolve to true or false. The code inside of this loop will repeat for as long as this condition is true.

"WHILE LOOPS" repeat the code after DO and stops repeating when the condition is false.

Example:

b = 4
while b < 10 do
	print( b )
	b += 1
end

--prints: 4 5 6 7 8 9

646

18 Mar 2023

Font