Dark horse programmers: circulation and three yuan.

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Which cycle:

Cycling conditions: the general is a relational expression, or logical expression is a value of type bool

The implementation process: firstly judging whether the condition while behind the establishment of parentheses, if established, namely true, is the body of the loop is executed, if the condition does not hold, or false, is not the body of the loop is executed, exit the while loop

Then, the first implementation of

which(true)

{

//A block of code

}

O-while cycle

Do

{

}While (condition);

The implementation process: first the implementation of do with braces, execution after the first, and then to determine the cycle condition is established, if true, would continue to have code execution in do, if the cyclic condition does not hold, then exit the DO-WHILE loop.

Features: first, then judge


For circulation is used to solve the known cyclic

The For loop syntax:

For (1. 2; expression; expression 3)

{

  The body of the loop;

}

Expression of 1: general circulation variables defined

Expression of 2: general circulation condition is also the relationship between the expression of

The expression 3: generally the condition change cycle condition

The implementation process: first the implementation of expression 1, then execute the expression of 2, then the body of the loop is executed, and then execution expression 3, then determine the expression 2 is established, if the establishment of the body of the loop is executed, if not established, then exit the for loop.

Two effect of Break:

,Out of the switch-case structure

,Jump out of the current cycle

Int.TryParse(“Want to convert the string”,out number)

Number is of type int.

Effect: try to convert a string into a int type, if the conversion is successful, returns a true, and the conversion after the success of the value assigned to number.

If the conversion failed, not reported abnormal, but returns a false, and the number is set to 0

Three yuan.:

Expression of 1? Expression of 2: expression 3,

If the expression value is 1 true, the expression of 2 value is the value of the expression of three yuan,

If the expression value of 1 for false, 3 of the value of the expression is three yuan to the value of the expression.

Expression of 1 general expressions

Type 2 and 3 expressions expressions must be consistent, and the entire three yuan to the same type of expression

Value type reference type

Int double decimal char the bool value type

The string reference types

Summary: today I learned cycling. Contains which do-which for learned about the importance of recycling, the role of the two Break. Learn a new conversion: int.tryParse (learning), to three yuan in the judgment of expression equivalence. There are simple value classes

Type and reference type

For details please see: <ahref="http://edu.csdn.net" target="blank"></a>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Jackson at November 14, 2013 - 2:49 PM