Search
Get Started
C
C#
•
3y ago
exove
❔ Need help explaining precedence in C#
int x = 10; int y = 20; x += y += y = 5; Console.WriteLine(x) //Output 35
int x = 10; int y = 20; x += y += y = 5; Console.WriteLine(x) //Output 35
Why is the above code does it evaluate to 35
?
Why is it not
y
= 5
y
+
= y
/
/ 10
x
+
= y
/
/ 20
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,010
Members
View on Discord
Similar Threads
Was this page helpful?
Yes
No
int
x
=
10
;
int
y
=
20
;
x
+=
y
+=
y
=
5
;
Console.
WriteLine
(x)
//Output 35
int
x
=
10
;
int
y
=
20
;
x
+=
y
+=
y
=
5
;
Console.
WriteLine
(x)
//Output 35
Similar Threads
need help in C#
C
C# / help
2mo ago
need help in c@
C
C# / help
2mo ago
✅ need help in c#
C
C# / help
15mo ago
✅ Need C# help
C
C# / help
3mo ago