Branch control

Branch control

  • Relational operators and relational expression

    Comparison operation implemented>, <, <=,> = priority higher than ==! =

    Relational expression true false zero zero

  • Logical and logical expressions

    1. && || !

    Non-logic, arithmetic operators, relational operators, logical AND, logical OR priority increment

    1. Judgment ch is an uppercase character

      (zh >= 'A') && (zh <= 'Z') 
         
      
  • Branch structure single, double, multi-branched structure

    1. Ternary operator expression 1? Expression 2: Expression 3

    2. Compound statement (Compound Statement) {} using the plurality of pieces of content comprising

      else is always paired with the nearest if (unpaired) statement

  • Switch statement

    1. Robustness - Good fault tolerance

    2. switch(表达式)
      {
          case 常量1: 				break;
          case 常量2: 				break;
          ……
          default :
      }
      

      After the match constant, it will perform all subsequent statements until it encounters a break

      Program test, try to cover all branches

Website: DiffidentAres's Blog

Guess you like

Origin www.cnblogs.com/La-pu-ta/p/12056443.html