# How to create a 2x1 Array?

**URL:** <https://discourse.julialang.org/t/how-to-create-a-2x1-array/8337>\
**Category:** New to Julia\
**Created:** [January 13, 2018, 5:51am UTC](https://discourse.julialang.org/t/how-to-create-a-2x1-array/8337 "2018-01-13T05:51:40Z")\
**Posts on this page:** 1\
**Showing post:** 40

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 27, 2019, 2:09pm UTC](https://discourse.julialang.org/t/how-to-create-a-2x1-array/8337/40 "2019-03-27T14:09:06Z")

</div>

How about a macro?

```julia
julia> using MacroTools

julia> macro col(expr)
         @capture expr [x__]
         Expr(:call, :hvcat, Expr(:tuple, [1 for _ in x]...), esc.(x)...)
       end
@col (macro with 1 method)

julia> @col [1,2]
2×1 Array{Int64,2}:
 1
 2

julia> @col [1, 2, 3]
3×1 Array{Int64,2}:
 1
 2
 3

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-create-a-2x1-array/8337)._
