1.10. C # judgment

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

The judgment structure requires the programmer to specify one or more conditions to be evaluated or tested, as well as statements to be executed if the condition is true (required) and statements to be executed if the condition is false (optional).

The following is a general form of a typical judgment structure in most programming languages:

Judgment statement in C #

1.10.1. Judgment sentence #

C # provides the following types of judgment statements. Click the link to see the details of each statement.

Statement

Description

If statement

An if statement consists of a Boolean expression followed by one or more statements.

If…else statement

An if statement can be followed by an optional else statement, and the else statement is executed when the Boolean expression is false.

Nested if statement

You can use another if or else if statement within one if or else if statement.

Switch statement

A switch statement allows you to test when a variable is equal to multiple values.

Nested switch statement

You can use another switch statement within another switch statement.

1.10.2. ? : Operator #

We have explained the conditional operator in the previous chapter ? : , which can be used instead of the if…else statement. Its general form is as follows:

Exp1 ? Exp2 : Exp3;

Among them Exp1 Exp2 and Exp3 is an expression. Please notethe use and location of colons.

? value of the expression is determined by the Exp1 . It was decided. If Exp1 is true, calculate Exp2 . The result is the entire ? value of the expression. If Exp1 is false, it is calculated Exp3 , the result is the entire ? value of the expression.

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.