1. Compound assignment operator
Operator | description | Instance |
---|---|---|
+= | Addition assignment operator | c += a is equivalent to c = c + a |
-= | Subtraction assignment operator | c -= a is equivalent to c = c-a |
*= | Multiplication assignment operator | c *= a is equivalent to c = c * a |
/= | Division assignment operator | c /= a is equivalent to c = c / a |
%= | Modulus assignment operator | c %= a is equivalent to c = c% a |
**= | Power assignment operator | c **= a is equivalent to c = c ** a |
//= | Divide and Divide Assignment Operator | c //= a is equivalent to c = c // a |
Two. Some partial knowledge in the if function
1.if(1) statement 1: //When the expression is a non-zero integer, the condition is judged to be true, and the statement is executed
2. if(0)/if(!=1) statement 1: //The condition is judged to be false, and the statement is not executed
3.if(x) statement 1: variable in expression, if x is not equal to 0, then the conditional judgment result is true, execute the statement
4.if(x+3.5) statement 1: expression variable, if x+3.5 is not equal to 0. The conditional judgment result is true, execute the statement [^Note that if there is no conditional judgment in the parentheses, the number in the parentheses Not equal to 0 is true, also in while]
Some partial knowledge in the while function
1.while(0): do not execute the loop body
2.while(1): Infinitely execute the change loop body, if not actively break, it will proceed wirelessly.