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

So I can use

@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).

julia> x_sym = :x
:x

julia> isdefined(Main, x_sym)
false

julia> x = 1
1

julia> isdefined(Main, x_sym)
true
4 Likes

That’s great! Thanks!