Code
int x = 12;
int z = 24;
int i = x = z;Code
SQL
Because the assignments are done from right to left, the variable x is first assigned the value that is stored in z (24). At this point, both x and z have the value of 24.C#
Next, i is assigned the value that is the result of the first assignment (24). At this point, x, z and i now all have the value of 24.
Because this behavior can be a little confusing, it's generally preferable to do each assignment on a separate lineCode
int x = 12;
int z = 24;
x = z;
int i = x;
Join the conversation! Your thoughts help the community grow.