# How do I find if a variable is defined when I know the corresponding symbol, but not the name?

**URL:** <https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 2, 2022, 12:54am UTC](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132 "2022-08-02T00:54:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [August 2, 2022, 12:54am UTC](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132/1 "2022-08-02T00:54:00Z")

</div>

I have a variable `a` that is defined:

```julia
a = 1

```

I can check whether `a` is defined

```julia
@isdefined a # true

```

Some other variables may or not be defined at this point in the program:

```julia
@isdefined b # false

```

However, I only have available a vector of symbols `[:a, :b]` and I want to check whether

the corresponding variables `a` and `b` are defined.

This does not help:

@isdefined :b # true

How can I find whether the variable `b` is defined if I only have the

corresponding symbol :b available?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [August 2, 2022, 1:13am UTC](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132/2 "2022-08-02T01:13:39Z")

</div>

if you need this you’re doing it wrong, that said

```julia
julia> isdefined(Main, :a)
false

julia> a = 3
3

julia> isdefined(Main, :a)
true

```

---

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [August 2, 2022, 1:37am UTC](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132/3 "2022-08-02T01:37:42Z")

</div>

Thanks. I guess the problem was the macro.
