# Difference between collect(x) and Array(x)?

**URL:** https://discourse.julialang.org/t/difference-between-collect-x-and-array-x/64652
**Category:** General Usage
**Created:** [July 14, 2021, 5:55pm UTC](https://discourse.julialang.org/t/difference-between-collect-x-and-array-x/64652 "2021-07-14T17:55:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)
#### Post date: [July 14, 2021, 5:55pm UTC](https://discourse.julialang.org/t/difference-between-collect-x-and-array-x/64652/1 "2021-07-14T17:55:36Z")

</div>

Is there any difference in the behavior of `collect(x)` vs `Array(x)`?

```julia
  collect(element_type, collection)

  Return an Array with the given element type of all items in a collection or iterable. The result has the same shape and number of dimensions
  as collection.

julia> collect(1:5)
5-element Vector{Int64}:
 1
 2
 3
 4
 5

julia> Array(1:5)
5-element Vector{Int64}:
 1
 2
 3
 4
 5

```

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [July 14, 2021, 6:02pm UTC](https://discourse.julialang.org/t/difference-between-collect-x-and-array-x/64652/2 "2021-07-14T18:02:04Z")

</div>

`Array`s are constructors and only work on things that are very `Array`-like, such as a range.

For example, `Tuple`s are not array-like. They have their own purpose and behavior. So `Array` is not defined for them.

```julia

julia> Array((1, 2))
ERROR: MethodError: no method matching Array(::Tuple{Int64, Int64})
Closest candidates are:
  Array(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/qr.jl:401
  Array(::Union{LinearAlgebra.Hermitian, LinearAlgebra.Symmetric}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/symmetric.jl:271
  Array(::LinearAlgebra.AbstractQ) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/qr.jl:521
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> collect((1, 2))
2-element Vector{Int64}:
 1
 2

```

In general, constructors, conversion, and “utility” methods like `collect` are distinct in Julia.
