C # Basic Learning the third day (. NET rookie's growth path-0 Basics to Mastery)

Source: Internet
Author: User

1. Compound assignment operator + = = *=/=%=

2. Relational operators > < >= <= = = = The expression that is concatenated by the relational operator is what we call a relational expression. Each expression can solve a fixed value.

3, BOOL type we use the bool type in C # to describe the right or wrong. type bool has only two values, one is true and one is False

4. Logical operator logic with && (shift+7) logic or | | (shift+ comma) logical non!  (Must be an exclamation point in English) for logic and logic or operators, we require that a value of type bool or a relational expression be placed on either side of the operator.      Logic and precedence are higher than logical OR, meaning that in a logical expression, if both logic and logic are present, we should first compute the logic with.  5, C # Syntax structure Learning order structure: The program enters from the main function, from the top to the next line of execution, each line of code will not fall. Branching structure--->if structure--->if-else structure selection structure (for multi-condition judgment, more than two even multi-condition)-->IF ELSE-IF structure-->switch-case structure cycle structure-->while Cyclic-->do-while cycle-->for cycle-->foreach cycle

6, if structure   syntax:   if (value of type bool or relational expression or logical expression)   {    code to execute;   }   Execution procedure:    run to If, first determine the value in parentheses after the IF, and if true, enter the braces in the IF with    execute code.    If False, the curly braces are skipped and nothing is done.   Execution Characteristics:    First judge, then execute, it is possible that a code will not be executed.

7. If-else structure     Syntax:   if (value of type bool or relational expression or logical expression)   {    code to execute;   }   else   {    code to execute;   }   Execution Process:    The program first determines if the condition in the parentheses with the if is true, and if true, executes the code in the curly braces with If. When execution is complete, jump out of the if-else structure.    if the condition with the if is returned as false, the curly brace with if is skipped, and the code in else is executed.   Execution Features:    first judgment, in execution, but at least one code executed (either execute if or else)   NOTE: Else always follow the closest if pairing   8, if else-if   Syntax:   if (judging condition)   {    code to execute;   }   else if (judging condition)    {    code to execute;   }   else if (judging condition)   {    code to execute;   }      else   {    code to execute;   }   Execution process: The program first determines whether the first if the judging condition is true, if it is set up, then executes the code in the curly braces with the IF, after completion, jumps out of the entire if else-if structure.   If the first if is not established, then continue to judge, in order to determine the conditions of each if the judgment, if the establishment of the implementation,   if each of the if the judging conditions are not established, see if there is an else in the current if ELSE-IF structure, if there is else ,   executes the ElseIf there is no else, then the if else-if structure does nothing.     9, exception capture    where there might be anomalies, we take out the appropriate processing, so that even if there is an exception, it will not cause my application to crash.    try{}catch{}      How to: Write code that is likely to have an exception in a try, and write code to execute after an exception occurs in the catch.    usage Tips: It's possible to kick it with an exception.    execution Process:     if the code in the try does not have an exception, the code in the catch is not executed.    if the code in the try has an exception, then immediately jumps to the catch and executes, and after the line of code that appears in the try,    even 100 lines of code are not executed.     &NBSP;10, scope of variables   variables declared in a function, which we call local variables. Local variables are scoped.   scope refers to the extent to which we can access or use the variable. The scope of the   local variable is the beginning of the curly brace that declares it, and the closing brace that corresponds to that curly brace ends.   We are able to access or manipulate variables just within this range, out of this range, we cannot do any   operation on the variable.

11, for the judgment of multi-conditional statements, we recommend using if else-if and switch-case structure if the judgment of the multi-criteria is interval, then we recommend using if else-if.      If the judgment of the multi-criteria is fixed, we recommend using the switch-case structure.     Switch-case structure Syntax: switch (the value of a variable or expression) {case value 1: Code to execute;    Break     Case Value 2: the code to execute;    Break     Case Value 3: the code to execute;    Break     Default: The code to execute;   break;//jumps out of the current switch-case structure.  Execution procedure: The program executes to switch, first calculates the result in the parentheses with the switch. Take the calculated results and match the values in each case.  If the match succeeds, the code with the case is executed, and after execution completes, it encounters a break and jumps out of the switch-case structure. If there is a mismatch between the values in each case, see if there is a default in the current switch-case structure, if there is default, the code in default is executed, and if not, the switch-case structure does nothing.

Video tutorial: http://yunpan.cn/ccZZ6UkXdP64s access Password 2fb6

Because I have to attend the training recently! So maybe the update can't be released in time! More videos can be added first group to communicate!

C # Basic Learning the third day (. NET rookie's growth path-0 Basics to Mastery)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.