What is the difference between these unary operators in C# ? . Can you provide me with example?
Please provide the name of each. :)
+= vs =+
++x vs
Let's visualize the first ones, += and =+.
Because "+" is action, "=" is assignment, so
+= is to add BEFORE assignment =+ is a bit confusing with "+", it could be "-", for example a=+7 or a=-7, anyway, it's a direct assignment.
+= is to add BEFORE assignment
=+ is a bit confusing with "+", it could be "-", for example a=+7 or a=-7, anyway, it's a direct assignment.
Similarly,
++x is "increment then return" x++ is "return then increase"
++x is "increment then return"
x++ is "return then increase"