C # in control flow

xiaoxiao2021-03-06  63

First, the control structure

First understand the comparison operator:

== equal to> = greater than or equal to <= less than or equal to> greater than

Understand the logical operator:

&& logical and || Logic OR! Logic Not

Warning: The order is:! && ||

IF ... ELSE ... Structure:

First way: if () {};

Second method: if () {} else {};

The third way: IF () {} else if () {} else if () {};

Fourth aspect: IF () {} else if () {} else {} else {};

Fifth aspect: IF () {IF () {};} else {if () {};

Conditions or triendal operators:

? :

Switch ... case ... Structure:

Switch (Statement)

{

Case Option1:

// DO STH.

Break;

Case Option2:

// DO STH.

Break;

DEFAULT:

// DO STH.

Break;

}

Note: Both each case keyword must be constant. Exiting the Case and Default statements must be displayed.

Jump statements include: return / continue / goto case

转载请注明原文地址:https://www.9cbs.com/read-119127.html

New Post(0)