1
$\begingroup$

I have noticed that the old trick of using:

ClearAll["Global`*"]

does not appear to work anymore. It does not clear the values of any of my variables. I assume this has to do with some sort of change in Mathematica.

Does anyone have a replacement for this?

NOTE: I also tried using the following without success:

ClearAll @@ {$Context<>"*"}
$\endgroup$
  • 1
    $\begingroup$ What does Context[variable] return for one of the variables that isn't cleared? $\endgroup$ – Carl Woll Nov 6 at 19:47
  • 1
    $\begingroup$ Possible duplicate of How do I clear all user defined symbols? $\endgroup$ – kickert Nov 6 at 20:18
  • $\begingroup$ ClearAll["Global*"]` should be working for you. Seems to be a local issue instead of a universal one. $\endgroup$ – kickert Nov 6 at 20:20
  • $\begingroup$ @Carl Woll - Context[variablename] just returns itself, i.e. the output is Context[variablename] $\endgroup$ – Colin Marcus Nov 7 at 20:07
3
$\begingroup$

I find quitting and restarting the kernel to be the best way.

$\endgroup$
  • 2
    $\begingroup$ E.g. using Quit[] This has the added advantage of restoring any system definitions that you might have accidentally over-written. $\endgroup$ – mikado Nov 6 at 20:00

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