# Confused by different behavior of assignments of Arrays and Numbers

**URL:** <https://discourse.julialang.org/t/confused-by-different-behavior-of-assignments-of-arrays-and-numbers/50182>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [November 15, 2020, 12:28pm UTC](https://discourse.julialang.org/t/confused-by-different-behavior-of-assignments-of-arrays-and-numbers/50182 "2020-11-15T12:28:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 15, 2020, 12:48pm UTC](https://discourse.julialang.org/t/confused-by-different-behavior-of-assignments-of-arrays-and-numbers/50182/2 "2020-11-15T12:48:46Z")

</div>

This is a common source of confusion for beginners (myself included). You can find related threads about it. One nice answer is this one:

> [@Assignment and mutation](https://discourse.julialang.org/t/assignment-and-mutation/19119/4):
>
> The simplest version of this I can come up with is this: Assignment changes which object a name refers to: x = ex causes the name x to refer to the value resulting from the evaluation of the expression ex. Assignment never changes the values of any objects. Mutation changes the value of an object: x[i] = ex and x.f = ex both mutate the object referred to by x changing a value at index or a property with a name, respectively. Mutation never changes what objects any names in any scope refer …

---

_[View the full topic](https://discourse.julialang.org/t/confused-by-different-behavior-of-assignments-of-arrays-and-numbers/50182)._
