c # Video Summary - Operator

Assignment Operators

Assignment operators : the assignment operator is the familiar "=" equal sign, but here it is called the assignment symbol.

For example : a = 3; where the equal sign is the assignment operator, so that no longer equals the mathematical sense, the equation 3 indicates the assigned variable assign the right to the left of the operator a.
Assignment expression : the assignment by the symbol "=" formula call on the connection assignment expression. For example: i = i + 3;
Note : variables can be reassigned to a variable once assigned a new value, the old value of the variable is ceased to exist.
E.g:

i=1;
i=7;
Console.WriteLine (i);
Console.ReadKey();

In this case the output value of 7 i; i is because the re-assignment.

Character translation

With \ a plus sign, composed character translation, generally used for special characters
Here Insert Picture Description

Arithmetic operators and compound assignment operators

Arithmetic operators : There are five, are: +, -, *, /,% (modulo, modulo)

Arithmetic expression: equation connected by arithmetic operators, such as: 1 + 1, ab (variables a, b front and declared initial value)

++ plus one from front and rear plus plus, for example: I +, I +
-, decrement a front and a rear Save Save, e.g., --i, i-
front and back plus the difference added:
expressed in a wherein, the first placed in front of a subtraction operation performed, the remaining operation is performed
in an expression, placed behind the first remainder calculation performed, a subtraction operation is performed
binary operators: we require two operations the number can for computing, these operators, we called binary operators, such as: -, +, *,%, =
unary operators: operators only one operand can be called a unary operation, e.g. : num ++;
unary higher priority than a binary

Relational Operators

6:

Greater than> Less than <
== (equal to, equal) ,! = (Unequal)
is greater than or equal to> = Less than or equal <=, can not write to separate

In the computer, we use Boolean (bool) to represent the type of right or wrong sentence

The result of a relational operation is a boolean
Boolean (bool) Type:
BOOL values are two:
true: true
false: false

Logical Operators

3: && (logical AND) || (logical OR)! (Logical negation)

Normally both sides are logical operators relational expression

Logic
1. If the expression 1 and expression 2 a is false, then the whole expression is to false
2. If the results of the two expressions are true, then the whole expression is true
Here Insert Picture Description
logic or
1. If the expression 1 or expression 2 as a result of true, then the whole expression is to true
2. If the result of the two expressions are false, then the final result is false
Here Insert Picture Description
logic NOT
1. If the expression is true , then the inverse of expression is wrong
2. If the expression is false, then the negated is right
Here Insert Picture Description

Published 56 original articles · won praise 14 · views 10000 +

Guess you like

Origin blog.csdn.net/wtt15100/article/details/104110356