# Usage of isdefined() function

**URL:** <https://discourse.julialang.org/t/usage-of-isdefined-function/34304>\
**Category:** General Usage\
**Created:** [February 7, 2020, 3:05pm UTC](https://discourse.julialang.org/t/usage-of-isdefined-function/34304 "2020-02-07T15:05:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spaceLem](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/spacelem/32/217628_2.png) [@spaceLem](https://discourse.julialang.org/u/spaceLem)\
**Post date:** [February 7, 2020, 3:05pm UTC](https://discourse.julialang.org/t/usage-of-isdefined-function/34304/1 "2020-02-07T15:05:30Z")

</div>

I recently returned to some code I wrote last year, where I used the `isdefined()` function. The old syntax was:

```julia
julia> x = 1
julia> isdefined(:x)
true
julia> isdefined(:y)
false

```

But since then `isdefined()` has changed and now takes two parameters, and I really can’t figure out from the help file what I’m meant to be adding to make this work. In this particular case `a` is an `Int`, but it could be anything.

How should I be using this function correctly?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 7, 2020, 3:10pm UTC](https://discourse.julialang.org/t/usage-of-isdefined-function/34304/2 "2020-02-07T15:10:52Z")

</div>

It is very likely that you want the macro form `@isdefined` instead.

---

<div class="post-metadata">

**Author:** ![spaceLem](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/spacelem/32/217628_2.png) [@spaceLem](https://discourse.julialang.org/u/spaceLem)\
**Post date:** [February 7, 2020, 3:18pm UTC](https://discourse.julialang.org/t/usage-of-isdefined-function/34304/3 "2020-02-07T15:18:33Z")

</div>

Ah, that wasn’t working for me, but then I noticed that the old syntax was `isdefined(:x)`, and I was trying `@isdefined :x`, when should have been `@isdefined x`. I’ve changed that and it seems to be working now, thank you.

I’ve updated the code in the original post in case anyone else wanders across this.
