+ 1
somebody explain me the comand x++ in the app is says it is x=x+1 but this operation is impossible
x++ == x=x+1 <= this is impossible
4 ответов
+ 13
Why should that be impossible? It is correct. On the right side of the assignment, x is replaced by it's current value, then the calculation is excuted and then the result is assigned to x. Everything fine.
+ 3
x++ is a short way of writing add 1 to x, the alternative is x = x + 1.
Don't think of this as an algebraic formula it is simply saying I want to add one to the current value of x and store the result in the same variable.
+ 1
in coding, this is impossible
x == x + 1
that is what you're thinking, an equivalent, that equates to false
x = x + 1 is an ASSIGNMENT, difference being if x = 4, now x = 5
+ 1
thx