How to | Clear My Definitions
When you set a value to a symbol, that value will be used for the symbol for the entire Wolfram System session. Since symbols no longer in use can introduce unexpected errors when used in new computations, clearing your definitions is very desirable.
Use Clear to clear the definitions for x and y:
Use ClearAll to clear not only the values and definitions of symbols but also the attributes and messages associated with them.
Now set f to be Listable, so that f maps over lists when lists are given as arguments:
Notice that after f is cleared, the attribute Listable still remains:
Use ClearAll to clear attributes and messages as well:
Use ClearAttributes to clear only the attributes of a function and retain its definition.
Redefine f and set it to be Listable as before:
You can also use Unset (=.) to clear any values or definitions made to a symbol:
Remove will remove a symbol completely until it is referenced again:
In the case of locally defined symbols, which store values set only for a specified portion of a program, definitions are cleared automatically after use. Symbols can be locally defined by using Block or Module.