9.15. Swift switch statement

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

The switch statement allows you to test when a variable is equal to multiplevalues. In the Swift language, as long as the match to case statement,the entire switch statement is executed.

9.15.1. Grammar #

The syntax of switch statements in the Swift language:

switch expression {
   case expression1  :
      statement(s)
      fallthrough /* optional */
   case expression2, expression3  :
      statement(s)
      fallthrough /* optional */

   default : /* optional */
      statement(s);
}

It is generally not used in switch statements fallthrough statement.

We need to pay attention to this. case if you do not use the fallthrough statement, the current case statement, the switch terminates and the control flow jumps to the next line after the switch statement.

If used fallthrough statement, the execution of the case or default statement that is executed regardless of whether the condition is met or not.

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.