Answer Overflow Logo
Change Theme
Search Answer Overflow
GitHub
Add Your Server
Login
Home
Popular
Topics
Gaming
Programming
exove
Posts
Comments
C
C#
•
Created by exove on 3/4/2023 in
#help
❔ 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
27 replies