+ 4
Can assignment operators switch += to =+ and if so how dose it change the code
Just asking a question
39 odpowiedzi
+ 2
To everybody who enjoys so much reading their own sentence in a 'hot today' thread:
You'd learn a lot more if you actually READ a discussion before you just thoughtlessly add another half-baked guess like a dozen people did before you.
+ 9
Have you tried this in a program?
That's the first thing you should do if you have this sort of question.
+ 5
Try it with -= and =-.
Print out the value.
Tell us what you found.
+ 5
Alyssa your links are irrelevant.
+ 4
Do you know, how a regular assignment works?
With only = ?
(Sorry I'm a bit like one of these teachers right now who want you to read their mind. ^^)
+ 4
You can += adds the together and changes value with the sum =+ changes value and makes the number a positive number or =- makes the num a negative number
+ 3
You got it. 🙂
+ 3
it can work
+ 3
amen HonFu
+ 2
Try and find out yourself. Do you have a computer?
+ 2
Thank you I appreciate all the help
+ 1
Yes but to be honest it didn't give me a error but I wasn't sure how it change the execution of the of the operation
+ 1
Int num1 = 4 , num2 = 8
Num2 += num1
Gives output 12 I get that it changes num 2 to num2+num1 but the other way around gives both num1 and num2 the assignment 4
+ 1
Try what I wrote.
+ 1
Do you understand how it works?
+ 1
Should I be looking at it like a algebraic problem
+ 1
I think so, it assigns a value to a identifier
+ 1
int x = 5
//x is a key 5 is the value
x-=2
// same as x=x-2 so x is now 3 because x=5-2=3
y=-2
// y is key with value of -2
+ 1
Lost me on that one
+ 1
Int x =5 , y = -7
y=+x out put for both x and y 5
X=+y out put for both x and y -7
So the only thing I can come up with is it acts as if the + is not there when it is on that side