a = 5
b = a + (a = a + 5)
result b = 15
Why the first \'a\' do not changes after that (a = a + 5)? But why second one changes? What exactly is
We always work left to right the Parens just group parts of the sum.So just remember always go left to right. I have gone step by step below
start with the question
a = 5
b = a + (a = a + 5)
So now change the first 'a' to a 5
b = 5 + (a = a + 5)
now lets do the sum in the parens
b = 5 + (a = 5 + 5)
This gives us
b = 5 + 10 or you could say b = 5 + (a = 10)
and the answer is
b = 15
also now
a = 10