Julia's assignment behavior differs from Fortran?

You are still thinking of variables as boxes, please look at the post I linked above.

No. xNew is bound to the value resulting from xOld+1 which is 2. xNew is not a closure which will always recompute its value when the variables used to define it are changed. What happened previously happened because you were dealing with a mutable object (a Vector/Array). You used two variables/labels to refer to the same object, and you changed inside the mutable object. So it reflected in the two variables because they are just names for the same object that now is different than it previously was.

3 Likes