Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the judgment statements of C #

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "what are the judgment sentences of C#", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the judgment sentences of C#"?

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 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 statements 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 statements you can use one switch statement within another switch statement. Operator

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

Exp1? Exp2: Exp3

Where Exp1, Exp2, and Exp3 are expressions. Please note the use and location of colons.

? The value of the expression is determined by Exp1. If Exp1 is true, the value of Exp2 is calculated, and the result is the entire? The value of the expression. If Exp1 is false, the value of Exp3 is calculated, and the result is the whole? The value of the expression.

The above is the content of this article on "what are the judgment sentences of C#". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report