Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I've noticed that in a notebook, if I define a variable, and then delete the definition, the variable stays assigned. Is there a quick way to see all the variables that are assigned? I can find them by using the debugger, but it is kind of tedious for a quick check.

share|improve this question
2  
?Global`* works. –  J. M. Dec 22 '11 at 6:52

1 Answer 1

Mathematica associates with each symbol a set of values. OwnValues is the one that stores value assignments to the symbol.

This code returns the list of symbol names (as strings) for those symbols whose OwnValues is non-empty, i.e. the symbol has been assigned a value:

Select[Names["Global`*"], 
 ToExpression[#, InputForm, OwnValues] =!= {} &]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.