# Inconsistent behavior with double indexing?

**URL:** <https://discourse.julialang.org/t/inconsistent-behavior-with-double-indexing/27904>\
**Category:** General Usage\
**Created:** [August 23, 2019, 5:24pm UTC](https://discourse.julialang.org/t/inconsistent-behavior-with-double-indexing/27904 "2019-08-23T17:24:06Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Andrea\_Pagnani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrea_pagnani/32/3136_2.png) [@Andrea\_Pagnani](https://discourse.julialang.org/u/Andrea_Pagnani)\
**Post date:** [August 23, 2019, 6:14pm UTC](https://discourse.julialang.org/t/inconsistent-behavior-with-double-indexing/27904/5 "2019-08-23T18:14:42Z")

</div>

See also the somehow related old discussion here …

> [@Create initialized arrays of structs](https://discourse.julialang.org/t/create-initialized-arrays-of-structs/7394):
>
> Dearests, today I found a disturbing (yet documented … ) behavior of julia. Let’s see: struct T a::Vector{Int}; end T(N) = T(zeros(Int,N)) Now aiming at a Vector of initialized Ts I (mistakenly) did a julia\> x=fill(T(3),2) 2-element Array{T,1}: T([0, 0, 0]) T([0, 0, 0]) The problem is that now the 2 elements in the vector are indeed the same: julia\> x[1].a[1] = 1; julia\> x 2-element Array{T,1}: T([1, 0, 0]) T([1, 0, 0]) No big deal, a comprehension would have produced my intended resu…

---

_[View the full topic](https://discourse.julialang.org/t/inconsistent-behavior-with-double-indexing/27904)._
