1.10. C # judgment

发布时间 : 2025-10-25 13:34:41 UTC      

Page Views: 9 views

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.

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。