5. Operators
5. Operators
prefix increment
In this method, the operator precedes the operand (e.g., ++a). The
value of operand will be altered before it is used.
int a = 1;
int b = ++a; // b = 2
postfix increment
In this method, the operator follows the operand (e.g., a++). The value
operand will be altered after it is used.
int a = 1;
int b = a++; // b = 1
int c = a; // c = 2
Decrement
prefix decrement
In this method, the operator precedes the operand (e.g., – -a). The value of operand
will be altered before it is used.
int a = 1;
int b = --a; // b = 0
postfix decrement
In this method, the operator follows the operand (e.g., a- -). The value of operand will
be altered after it is used.
int a = 1;
int b = a--; // b = 1
int c = a; // c = 0
C# Assignment Operators
As with comparison operators, you can also test for True or False values
with logical operators.
Logical operators are used to determine the logic between variables or
values:
Logical Operators
Thank You