what is the operation of num2 =+ num1? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what is the operation of num2 =+ num1?

as if we write num2 += num1 then operation performed is // num2 = num2 + num1.... so what happens when we use =+ operator?

6th Aug 2016, 11:19 AM
Kabir Singh
Kabir Singh - avatar
16 Answers
+ 3
=+ is wrong This operand is not exist += is true
12th Aug 2016, 10:28 AM
Mohammad Reza Karimi
Mohammad Reza Karimi - avatar
+ 1
Doesn't give an error, basically it treats the operation like the + doesn't exist. For people saying error, try it for yourself before you comment. There isn't an error. You shouldn't be writing your code as =+, but if you do, it'll be treated as just =.
6th Aug 2016, 11:58 AM
James
James - avatar
+ 1
it's not giving an error, I never said about error but instead when I print num2 with =+ operation, it shows the value of num1. so was just curious what exactly happens with using =+ operation
6th Aug 2016, 3:03 PM
Kabir Singh
Kabir Singh - avatar
+ 1
some are confusing perhaps with num2 +=num1 wich is just num2=num2+num1
12th Aug 2016, 3:36 AM
malbathaan
0
As I said. If you use =+ you're saying =. The + is ignored. It literally does nothing else
6th Aug 2016, 3:06 PM
James
James - avatar
0
thanks James.....your answer helped and was satisfactory
7th Aug 2016, 4:04 AM
Kabir Singh
Kabir Singh - avatar
0
Doesn't give an error, basically it treats the operation like the + doesn't exist. For people saying error, try it for yourself before you comment. There isn't an error. You shouldn't be writing your code as +=, but if you do, it'll be treated as just =.
7th Mar 2021, 10:57 AM
Junaid Ul Islam
Junaid Ul Islam - avatar
0
+=
16th Oct 2022, 5:11 AM
Galang Joan Marie Francisco
Galang Joan Marie Francisco - avatar
0
Type in the missing operator to add the value of num2 to num1: int num1 = 8; int num2 = 42; num1 num2; The answer is +=
16th Feb 2023, 6:25 AM
Jembere Guta
Jembere Guta - avatar
0
Type in the missing operator to add the value of num2 to num1: int num1 = 8; int num2 = 42; num1 num2;
12th Apr 2023, 12:08 PM
Muthu
Muthu - avatar
- 1
error
6th Aug 2016, 12:39 PM
Maqsood Rocky
Maqsood Rocky - avatar
- 1
it's num2=num2+num1 ! Answer to above asked question !
6th Aug 2016, 3:14 PM
kiran rajput
kiran rajput - avatar
- 2
its gives an operator error.
6th Aug 2016, 12:11 PM
Niraj Singh
Niraj Singh - avatar
- 2
it should be num2=num1++
6th Aug 2016, 12:40 PM
Maqsood Rocky
Maqsood Rocky - avatar
- 2
Excuse me kabir, there is nothing like =+ existing for Java or C++ as per my study.
6th Aug 2016, 3:16 PM
kiran rajput
kiran rajput - avatar
- 2
I
6th Aug 2016, 4:19 PM
Hai Than
Hai Than - avatar