0

What's happening here?

int x = 10; x += 4; // equivalent to x = x + 4 x -= 5; // equivalent to x = x - 5 how?pls...

9th Oct 2017, 12:47 PM
Nabil Khan
Nabil Khan - avatar
2 Respostas
+ 1
As Freezemage wrote is simple. In the first case x+=4 means that x will have a new value which will be x+4 and of course x=x+4=10+4=14 In second case in the same way new x will be x-5 so x=x-5=14-5=9
9th Oct 2017, 1:39 PM
Daniel
Daniel - avatar
0
To make it more simple, look at it that way: x += 4 -> x + 4 = x x -= 5 -> x - 5 = x
9th Oct 2017, 12:54 PM
Freezemage
Freezemage - avatar