# Structure Usage

**URL:** <https://discourse.julialang.org/t/structure-usage/42269>\
**Category:** New to Julia\
**Created:** [June 29, 2020, 9:06pm UTC](https://discourse.julialang.org/t/structure-usage/42269 "2020-06-29T21:06:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [June 29, 2020, 9:28pm UTC](https://discourse.julialang.org/t/structure-usage/42269/2 "2020-06-29T21:28:06Z")

</div>

`fill` will re-use the same element multiple times, not make independent copies. Thus:

```julia
julia> tri = fill([1], 3) # the same array, 3 times
3-element Array{Array{Int64,1},1}:
 [1]
 [1]
 [1]

julia> push!(tri[1], 2) # mutate the sole inner array
2-element Array{Int64,1}:
 1
 2

julia> tri
3-element Array{Array{Int64,1},1}:
 [1, 2]
 [1, 2]
 [1, 2]

julia> tri[3] = [3,4,5]; # replace an element of the outer array

julia> tri
3-element Array{Array{Int64,1},1}:
 [1, 2]
 [1, 2]
 [3, 4, 5]

```

---

_[View the full topic](https://discourse.julialang.org/t/structure-usage/42269)._
