The operator is the symbol used for the operation, acting on one or more operands. (operand: The data that participates in the operation. )
operator + + and--
+ +, called the self-add operator . For example, number 22nd today, a day next year, written in code is this:
int number=22;//today No. 22nd
number=number+1;//tomorrow, in today's days on +1;
number++; Number=number+1; The function is the same, the value of the variable is +1.
--called the self-decrement operator . Today, for example, number 22nd, yesterday, a day less, written in code is this:
int number=22;//today number 22nd number--;//equals to number=number-1;
Other than that
number++; with number--; can also write + +
number; or--number;
Variable name + +
Calculates the same return result as a variable
Increment the value of a variable by 1
+ + variable Name
The result returned by the calculation is a variable self-increment of 1
Increment the value of a variable by 1
--Variable name
The result returned by the calculation is a variable self minus 1
subtract 1 from a variable's value
Variable name--
The calculation returns the same result as the variable
subtract 1 from a variable's value
Getting Started with C # basics (arithmetic operator + +-)