20

Is there a way to list all the user-defined variables & function in a Notebook ?

I would like this for the comfort it brings to a notebook overview as well as to spot potential multiple use of a variable name (thus redefining it accidental)

2 Answers 2

26

To find names in a context, say in the Global context, try

Names["Global`*"] 

--Nasser

Sign up to request clarification or add additional context in comments.

4 Comments

More straightforward: Names[$Context<>"*"].
& Alexey, Thank You ! Would you think about a way to list separately the Function, Variable or options used ? Many Thanks.
@500, I do not know how to find if it is a function you defined, but for build in function, this is how I do it isFunction[name_String]:=Module[{m}, If[Length[SyntaxInformation[Symbol[name]]]>0,True,False]]; for example: isFunction["Plot"] will return True. this works only for functions which have synatxInformation.
Is Names[$Context<>"*"] more straightforward because it gives the current context instead of assuming that the current context is Global?
1

If you want a friendly interface to pop up, try the standard information printing character ? or ??

You can apply it to the global namespace as:

?Global`* 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.