+ 5

what's mean x -= y += 9

You can use multiple assignment operators in one line, such as x -= y += 9. Whether it is equal to x=x-9 &y=y+9 & x-9=y+9 ???

25th Oct 2018, 10:02 AM
Echo.Yan
Echo.Yan - avatar
8 Respostas
+ 9
x = x-(y+9) is what i would say
25th Oct 2018, 10:35 AM
Mbrustler
Mbrustler - avatar
+ 6
This doesn't exactly answer the question but I have to say it: You can write it this way but it's bad practice. Also bad practice is nested ternaries. Generally when we write code we want to write it in a way that is easily understood. e.g. If you look at a well written piece of code 1 year later you can understand what's happening in the code fairly quickly and make the necessary adjustments/corrections/changes. If you look at a piece of code that's written like a cipher 1 year later I guarantee you that you'll say: "f
amp;@ this, ill rewrite the whole thing."
26th Oct 2018, 6:22 AM
Haris
Haris - avatar
+ 5
Just great answer by Mbrustler . But remember assignment works different depending the language. Like in python x = x + 1 x += 1 Even this have the same result. this two line of codes still works different for python.
25th Oct 2018, 10:55 AM
Anya
Anya - avatar
+ 4
Gordie in the last part, x will be assigned to x-y-9 and not x-y+9. But you cleared that in last 2 lines so it doesn't matter 😄
25th Oct 2018, 11:31 AM
Yash✳️
Yash✳️ - avatar
+ 1
x-=y+=9 means x-=(y+=9) I.e y=y+9 x=x-y
26th Oct 2018, 4:29 PM
Manoj Kumar
Manoj Kumar - avatar
+ 1
It means y=y+9 x=x-y
14th Mar 2019, 8:10 PM
Manoj Kumar
Manoj Kumar - avatar
0
Breakdown the string by 'equal' sign. You get x=x-y as there is x-=y; and y=y+9 as there is y+=9 So, substitute and get the final result as follows, x=x-(y+9).
26th Oct 2018, 7:40 AM
Pranab Ranjan Mandal
Pranab Ranjan Mandal - avatar
0
x = x - y, where y = y + 9
26th Oct 2018, 11:43 PM
Carlette Jean A.