To see the the difference, try:
a = 1;
f[i_] := a + i
f[1]
2
Clear[a]
f[1]
NameQ["a"]
1 + a
True
Remove[a]
f[1]
NameQ["a"]
1 + Removed["a"]
False
As you can see, Remove
has a different effect on other definitions that a
is inside of. After Removing, a
is not allowed to be used anymore because it doesn't exist anymore, even symbolically. You have to recreate a
and any function depending on it, because even if you recreate a
, f
will still be in a broken state:
a = 1;
f[1]
1 + Removed["a"]
Remove
is often overkill, but it's sometimes necessary if you need strict control over which symbols exist and which ones don't. And as Goofy remarks in a comment: Remove also deletes the symbol from the auto completion functionality in the FrontEnd, which can be useful to be aware of.
In short summary:
Clear
deletes most "normal" definitions associated with a symbol, but not Options
and Attributes
etc.
ClearAll
deletes everything associated with a symbol, including Options
and Attributes
(and some other stuff). In normal everyday use of WL, you'll hardly ever need a bigger cannon than ClearAll
.
Remove
deletes the entire existence of a symbol itself.