# Zero-dimensional arrays are acting strange

**URL:** <https://discourse.julialang.org/t/zero-dimensional-arrays-are-acting-strange/96909>\
**Category:** New to Julia\
**Tags:** arrays\
**Created:** [March 31, 2023, 7:00pm UTC](https://discourse.julialang.org/t/zero-dimensional-arrays-are-acting-strange/96909 "2023-03-31T19:00:15Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![sadish-d](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sadish-d/32/48058_2.png) [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Post date:** [March 31, 2023, 8:52pm UTC](https://discourse.julialang.org/t/zero-dimensional-arrays-are-acting-strange/96909/9 "2023-03-31T20:52:34Z")

</div>

For anyone interested, here’s some earlier discussion on a similar topic. People smarter than I also tend to think that behavior of `Array{Int64, 1}()`, `Array{Int64, 0}()`, `Array{Int64, 2}()` is inconsistent.

> [@Why does Array{Int}() product Array{Int, 0} and not Array{Int, 1}](https://discourse.julialang.org/t/why-does-array-int-product-array-int-0-and-not-array-int-1/11298/25):
>
> Union{Missing, T} is not 100% as fast as just using T, causes more allocations, and is not compatible with C code: julia\> struct Foo x::Int end julia\> struct FooM x::Union{Missing,Int} end julia\> function fillfoo(T,n) ret = Array{T}(undef, n) for k = 1:n ret[k] = T(1) ret end end julia\> @time fillfoo(Foo, 100000); 0.046550 seconds (199.50 k allocations: 3.808 MiB) julia\> @time fillfoo(FooM, 100000); 0.049624 seconds (…

---

_[View the full topic](https://discourse.julialang.org/t/zero-dimensional-arrays-are-acting-strange/96909)._
