. NET basic step by step curtain [operators, placeholders, escape characters],. net escape
Operators, placeholders, and escape characters
Well, after winning the five games, I finally got three drills, and there was still a long way to go from a star. I suddenly remembered that today's blog was not written yet, and I am decisive to my teammates, to write a blog .... It is better to update an article every day. Otherwise, you should stay up late at night. As a result, you will not be able to get up in the morning and be late for work. Well, you have to say a lot about it:
OPERATOR:
Arithmetic Operator:
+
-
*
/
%
* There is a key point and an interview question:
++: Divided into the front ++ and the back ++, whether it is the front ++ or the back ++, the final result is to add one to this variable.
In the difference expression, if it is the first ++, first add the variable itself, and then take the value after this plus to participate in the operation.
If it is the plus ++, the original value is used in the calculation. After the calculation is completed, the variable itself is added;
--: Divided into before -- and after --, whether it is before -- or after --, the final result is to subtract one from this variable.
In the difference expression, if it is a forward --, first subtract one from the variable itself, and then take the value after the subtraction to participate in the operation.
If it is post---, the original value is used in the calculation. After the calculation is completed, the variable itself is reduced by one.
The usage of "+" is described as follows:
1) connection: when one side of the plus sign is a string, the plus sign serves as a connection.
2) sum: when the two sides are numbers
Relational operators: Relational operators are used to describe the relationship between two things.
>
<
> =
<=
=
! =
The expressions connected by Relational operators are called relational expressions.
The result of a relational expression is of the bool type.
Ternary operators:
? :
Expression 1? Expression 2: expression 3
If 1 is true, execute 2, false execute 3.
Assignment operator:
=: Indicates the meaning of the value assignment, indicating to assign the value on the right of the equal sign to the variable on the left of the equal sign.
The expression connected by equal signs is called a value assignment expression.
Note:: Each expression can be used to remove a value. For a value assignment expression, the value of the variable on the left of the equal sign,
Is the value of the entire value assignment expression.
Logical operators:
& Logic and
| Logical or
! Non-logical
The expressions connected by logical operators are called logical expressions.
Logical operators are usually placed on both sides of a relational expression or bool type value.
The result of a logical expression is also of the bool type.
Logic &&
Expression 1 & Expression 2
Expression 1 |
Expression 2 |
Expression 1 & Expression 2 |
True |
True |
True |
False |
True |
False |
True |
False |
False |
False |
False |
False |
Logic or |
Expression 1 | expression 2
Expression 1 |
Expression 2 |
Expression 1 | expression 2 |
True |
True |
True |
True |
False |
True |
False |
True |
True |
False |
False |
False |
Non-logical!
! Expression
Expression |
! Expression |
True |
False |
False |
True |
Compound assignment operator:
+ =:
-=
* =
/=
% =
Placeholder:
Usage method: First open a pit and then fill in a pit.
Note the following when using placeholders:
1. If you have dug a few pitfalls, you should fill them out. If you leave it blank, an exception is thrown.
2. output sequence: output according to the digging sequence.
Escape Character:
An escape character is a '\' + special character that constitutes a special character.
\ N: line feed
\ ": Double quotation marks
\ T: a tab key space.
\ B: indicates a backspace key, which has no effect on both sides of the string.
\ R \ n: windows OS does not know \ n, only \ r \ n
\: Represents \
@ Symbol
1. Cancel the escape Function of \ In the string so that it is simply expressed as '\'
2. output the string in the edited original format.
The code in this article is only used as an example. It is intended for beginners to be more familiar with the code.
The priority of the previous operator is attached:
Okay, today's. NETOperators, placeholders, and escape charactersThat's it.,I hope it will help beginners. I also hope that the great gods will take us with us, pack us with force, and fly us with us...
Finally, make a small advertisement: QQ group:. NETStep by stepOne ScreenGroup Number:590170361(Add group remarks: what you see in the blog Park)