Lua
programing language
break
statement is inserted into the body of the loop to exit the current loop or statement and start the script to execute the statement that follows.
If you use loop nesting In Flow chart: The following example executes The execution result of the above code is as follows:
break
statement stops the execution of the innermost loop and starts the outer loop statement of execution. 4.11.1. Grammar #
Lua
programming language
break
statement syntax format:break

4.11.2. Example #
while
loop that outputs the value of a when the variable an is less than 20:00 and terminates execution of the loop when an is greater than 15:00:--[ Define variables --]
a = 10
--[ While loop --]
while( a < 20 )
do
print("The value of a is:", a)
a=a+1
if( a > 15)
then
--[ Terminating a loop using a break statement --]
break
end
end
The value of a is: 10
The value of a is: 11
The value of a is: 12
The value of a is: 13
The value of a is: 14
The value of a is: 15