What is x +=3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is x +=3

can someone tell me what is the value of x here

25th May 2018, 2:27 PM
Piyush
5 Answers
+ 10
it's a short hand techniques x*=3; //equivalent to x=x*3; x+=3;//equivalent to x=x+3;
25th May 2018, 2:42 PM
Aman Kumar Pandit
Aman Kumar Pandit - avatar
+ 4
It is a short hand for x=x+3
25th May 2018, 4:33 PM
Mitali
Mitali - avatar
+ 3
x = x + 3; x is 3 more than it was before. += is a short version of that. Same goes to -=, /= and so on
25th May 2018, 2:38 PM
Paul
+ 2
It depends on what x was before. For example: // here, x is set to 0 x = 0; // here, we set x to be x + 3 (0+3 = 3) x += 3; x += 3 is the same as x = x + 3. += is just a shorter way to say the same thing.
25th May 2018, 2:43 PM
Xpl0it
Xpl0it - avatar
+ 2
Short hand for x=x+3; What's on the right-side is stored in the variable x.
25th May 2018, 9:43 PM
Apple Blossom
Apple Blossom - avatar