# How do I check if variable is defined in the current workspace? (not using the macro)

**URL:** https://discourse.julialang.org/t/how-do-i-check-if-variable-is-defined-in-the-current-workspace-not-using-the-macro/48545
**Category:** New to Julia
**Created:** [October 17, 2020, 3:20pm UTC](https://discourse.julialang.org/t/how-do-i-check-if-variable-is-defined-in-the-current-workspace-not-using-the-macro/48545 "2020-10-17T15:20:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)
#### Post date: [October 17, 2020, 3:20pm UTC](https://discourse.julialang.org/t/how-do-i-check-if-variable-is-defined-in-the-current-workspace-not-using-the-macro/48545/1 "2020-10-17T15:20:41Z")

</div>

So I can use

```julia
@isdefined my_undefined_variable

```

and it returns false. But is there something similar without using the macro (a function)? There seems to be a function `isdefined()`, but I don’t know how it works (not as I expected at least).

---

<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: [October 17, 2020, 3:29pm UTC](https://discourse.julialang.org/t/how-do-i-check-if-variable-is-defined-in-the-current-workspace-not-using-the-macro/48545/2 "2020-10-17T15:29:43Z")

</div>

```julia
julia> x_sym = :x
:x

julia> isdefined(Main, x_sym)
false

julia> x = 1
1

julia> isdefined(Main, x_sym)
true

```

---

<div class="post-metadata">

### Author: ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)
#### Post date: [October 17, 2020, 3:35pm UTC](https://discourse.julialang.org/t/how-do-i-check-if-variable-is-defined-in-the-current-workspace-not-using-the-macro/48545/3 "2020-10-17T15:35:54Z")

</div>

That’s great! Thanks!
