# Recursive type?

**URL:** <https://discourse.julialang.org/t/recursive-type/16049>\
**Category:** New to Julia\
**Created:** [October 9, 2018, 12:25am UTC](https://discourse.julialang.org/t/recursive-type/16049 "2018-10-09T00:25:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [October 9, 2018, 12:25am UTC](https://discourse.julialang.org/t/recursive-type/16049/1 "2018-10-09T00:25:12Z")

</div>

is it possible to define a recursive type such that it will store a concrete type at the end?

```julia
julia> struct Recur
           data::RecurOrInt64
       end
ERROR: UndefVarError: RecurOrInt64 not defined
Stacktrace:
 [1] top-level scope at none:0

julia> RecurOrInt64 = Union{Recur, Int64}
ERROR: UndefVarError: Recur not defined
Stacktrace:
 [1] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Post date:** [October 9, 2018, 1:12am UTC](https://discourse.julialang.org/t/recursive-type/16049/2 "2018-10-09T01:12:29Z")

</div>

```julia
julia> struct Recur
           data::Union{Recur,Int64}
       end

julia> RecurOrInt64 = Union{Recur, Int64}
Union{Recur, Int64}

julia> rr12 = Recur(Recur(12))
Recur(Recur(12))

julia> typeof(rr12.data)
Recur

julia> typeof(rr12.data) <: RecurOrInt64
true

```
