+ 1

+= means?

answer please

11th Mar 2018, 11:18 PM
Code Race
Code Race - avatar
3 odpowiedzi
12th Mar 2018, 12:50 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
+= is shortened form for adding value in certain variable. For example "a = a + 2" is same as "a += 2"
11th Mar 2018, 11:24 PM
Vladi Petrov
Vladi Petrov - avatar
+ 6
it's known as short hand assignment operator. += is used to add to values and store them in the 1st one variable. int A=5, B=10; A = A+B; //A=15 it can be written as, int A=5, B=10; A += B; //A=15 both will produce the same output. it's save the time and looks pretty cool. there are some other assignment operators, A+=B ~ A=A+B A-=B ~ A=A-B A*=B ~ A=A*B A/=B ~ A=A/B A%=B ~ A=A%B A<<=B ~ A=A<<B A>>=B ~ A=A>>B
13th Mar 2018, 11:30 PM
Ajay Agrawal
Ajay Agrawal - avatar