+ 3

Please explain '+=' statment

24th Feb 2017, 7:36 AM
abhi ram
abhi ram - avatar
6 Respostas
+ 17
x+=a --> x=x+a x-=a --> x=x-a x*=a --> x=x*a x/=a --> x=x/a x%=a --> x=x℅a x^=a --> x=x^a
24th Feb 2017, 10:32 AM
Sina Bahmanpour
Sina Bahmanpour - avatar
+ 4
int x = 4; x += 4; // Adds 4 to x and assigns that value to x. // same as: x = x + 4;
24th Feb 2017, 7:43 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
'a += b' is technically equivalent to 'a = a + b'. It's basically a faster way to write code that sums values and adds them to an existing variable.
24th Feb 2017, 7:44 AM
Lari Liuhamo
Lari Liuhamo - avatar
+ 1
it is just shorthand of x=x+
24th Feb 2017, 9:39 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
a+=b is similar to a=a+b;
26th Nov 2018, 5:37 PM
Madhusudan Babar
Madhusudan Babar - avatar
- 1
x+=1 means x = x + 1 for example 5+=1 means (5 = 5+1) = (5+=1) simple maths 🙂
7th Oct 2018, 12:20 PM
Lahiru Madushan
Lahiru Madushan - avatar