Clear

Clear[symbol1,symbol2,]

clears values and definitions for the symboli.

Clear["form1","form2",]

clears values and definitions for all symbols whose names match any of the string patterns formi.

Details

  • Clear does not clear attributes, messages, or defaults associated with symbols.
  • Clear allows abbreviated string patterns containing the following metacharacters:
  • *zero or more characters
    @one or more characters, excluding uppercase letters
    \\*, etc.literal *, etc.
  • Clear["context`*"] clears all symbols in a particular context.
  • Clear is HoldAll.
  • Clear does not affect symbols with the attribute Protected.

Examples

open allclose all

Basic Examples  (2)

Clear a variable:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Clear a function definition:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Scope  (4)

Generalizations & Extensions  (2)

Applications  (1)

Properties & Relations  (2)

Possible Issues  (1)

Neat Examples  (1)

See Also

ClearAll  Unset  TagUnset  ClearAttributes  Remove

Tutorials

Introduced in 1988
(1.0)