9.22. Swift Break statement

发布时间 :2023-12-08 01:10:05 UTC      

Swift break statement immediately ends the execution of the entire control flow.

If you are using a nested loop (that is, one loop is nested within another loop) break statement stops executing the innermost loop and then starts executing the next line of code after the block.

9.22.1. Grammar #

Swift break the syntax format of the statement is as follows:

break

Flow chart:

Image0

9.22.2. Example #

import Cocoa

var index = 10

repeat{
    index = index + 1

    if( index == 15 ){  // Terminate loop when index equals 15
        break
    }
    print( "The value of index is \(index)")
}while index < 20

The output of the above program execution is as follows:

The value of index is 11
The value of index is 12
The value of index is 13
The value of index is 14

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.