# List existing global variables, e.g. via varinfo()

**URL:** <https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124>\
**Category:** General Usage\
**Tags:** interactiveutils\
**Created:** [February 24, 2023, 11:13am UTC](https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124 "2023-02-24T11:13:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [February 24, 2023, 11:13am UTC](https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124/1 "2023-02-24T11:13:34Z")

</div>

The output of the function `varinfo()` is of type: `Markdown.MD`  
For me it is not clear, how to handle this variable type.  
My task is: Display the available variables  
Below is my workaround, but I am sure, there is a more elaborated way to handle this output.  
Here my snippet:

```julia
a = "foo"
varinfo_ = varinfo(; sortby=:name)
@info(string("\ntypeof varinfo()-output: ", typeof(varinfo_), " \n "))
_variable = Dict{String, String}()
for (i_name, _, i_summary) in varinfo_.content[1].rows[2:end]
    println("i_summary: ", i_summary, ", typeof(i_summary): ", typeof(i_summary))
    if i_summary != "Module"
        push!(_variable, (i_name => i_summary))
    end
end
@show _variable

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 24, 2023, 2:02pm UTC](https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124/2 "2023-02-24T14:02:01Z")

</div>

`varinfo` just calls the [`names` function](https://docs.julialang.org/en/v1/base/base/#Base.names) and formats its output. It is probably easier to do what you want by calling `names` directly:

```julia
filter(n -> !isa(getfield(Main, n), Module), names(Main))

```

I submitted a PR to clarify the `varinfo` documentation: [cross-reference names from varinfo docstring by stevengj · Pull Request #48779 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/48779)
