We've had quite some discussion on x = x++ before in the Q&A. The reason is because you are assigning the old value of var back to var after incrementing it with postfix, i.e. The postfix increment happens before the assignment.
Shouldnt you use x = ++x instead?
Idk about c++ and java but if they have the same rule on "++" as c# then x = x++ simply takes the x first and then add by 1, but it doesnt get added cuz the variable x already took its own value.
While ++x add by 1 then assign the variable.
Pls correct me if im wrong, im new at this
because it will first assign value of var then it will increment it, as it is assignment operation the right hand side value is only for operation, it will not change and the value of that operation is assigned to variable at left hand side.
here value of a+b is assigned to c but value of a and b is same as before..
hope you get it !