4.11. Lua break statement

发布时间 :2023-10-12 23:00:03 UTC      

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 break statement stops the execution of the innermost loop and starts the outer loop statement of execution.

4.11.1. Grammar #

In Lua programming language break statement syntax format:

break

Flow chart:

Image0

4.11.2. Example #

The following example executes 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 execution result of the above code is as follows:

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

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.