=.
)
Unset
[x]x=.
a = 2
a =.
a
Unsetting an already unset or never defined variable will not change anything:
a =.
b =.
Unset
can unset particular function values. It will print a message if no corresponding rule is found.
f[x_] =.
f[x_] := x ^ 2
f[3]
f[x_] =.
f[3]
You can also unset OwnValues
, DownValues
, SubValues
, and UpValues
directly. This is equivalent to setting them to {}
.
f[x_] = x; f[0] = 1;
DownValues[f] =.
f[2]
Unset
threads over lists:
a = b = 3;
{a, {b}} =.