Create an array using the output of size()

julia> a = rand(3, 3)
3×3 Matrix{Float64}:
 0.893835  0.365916   0.921844
 0.971955  0.0643828  0.63403
 0.149759  0.247479   0.0915574

julia> zeros(size(a))
3×3 Matrix{Float64}:
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0

julia> zeros(Int, size(a))
3×3 Matrix{Int64}:
 0  0  0
 0  0  0
 0  0  0

:slight_smile:

3 Likes