# How to check if an attribute inside a mutable struct is defined?

**URL:** <https://discourse.julialang.org/t/how-to-check-if-an-attribute-inside-a-mutable-struct-is-defined/7467>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [December 3, 2017, 5:03am UTC](https://discourse.julialang.org/t/how-to-check-if-an-attribute-inside-a-mutable-struct-is-defined/7467 "2017-12-03T05:03:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [December 3, 2017, 5:03am UTC](https://discourse.julialang.org/t/how-to-check-if-an-attribute-inside-a-mutable-struct-is-defined/7467/1 "2017-12-03T05:03:03Z")

</div>

Is there any way to check if an attribute inside a mutable struct is defined?

```julia
julia> mutable struct Point x ; y ; Point() = new() end

julia> p = Point()
Point(#undef, #undef)

julia> isdefined(p.x)
ERROR: UndefRefError: access to undefined reference

```

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [December 3, 2017, 5:22am UTC](https://discourse.julialang.org/t/how-to-check-if-an-attribute-inside-a-mutable-struct-is-defined/7467/2 "2017-12-03T05:22:01Z")

</div>

`isdefined(p, :x)`
