Unary Operators
Learn about unary operators in this lesson.
We'll cover the following...
We'll cover the following...
In the previous lesson we discussed the basic operators used in C#. One of the types listed was the unary operators. Let’s learn about them now.
Unary Operators Example
Take a look at the example below which uses the unary operators.
Code Explanation
When evaluating expressions:
postIncrement(x++) andpostDecrement(x--) operators return their current value and then apply the operators.preIncrement(++x) andpreDecrement(--x) operators apply the operators to the variable prior to returning the final value.
In the code ...