is an attribute that, once assigned, prevents modification of any attributes of a symbol.
Locked
is an attribute that, once assigned, prevents modification of any attributes of a symbol.
Examples
open all close allBasic Examples (2)
Properties & Relations (5)
The attribute Locked, once set, cannot be removed:
SetAttributes[f, Locked]ClearAttributes[f, Locked]Attributes[f]By itself, the attribute Locked does not prevent adding definitions to a symbol:
SetAttributes[f, Locked]f[x_] := x ^ 2f[2]However, no new attributes can be added:
SetAttributes[f, ReadProtected]If a symbol is protected and locked, its definitions can no longer be changed:
f[x_] := x ^ 2;
SetAttributes[f, {Protected, Locked}]f[x_] := x ^ 3Unprotect[f]Clear can clear the values and definitions for locked symbols:
f[x_] := x ^ 2;
SetAttributes[f, Locked]Definition[f]Clear[f]Definition[f]ClearAll does not affect locked symbols:
f[x_] := x ^ 2ClearAll[f]Definition[f]Remove does not affected locked symbols:
SetAttributes[f, Locked]Remove[f]Definition[f]Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Locked, Wolfram Language function, https://reference.wolfram.com/language/ref/Locked.html.
CMS
Wolfram Language. 1988. "Locked." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Locked.html.
APA
Wolfram Language. (1988). Locked. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Locked.html
BibTeX
@misc{reference.wolfram_2026_locked, author="Wolfram Research", title="{Locked}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Locked.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_locked, organization={Wolfram Research}, title={Locked}, year={1988}, url={https://reference.wolfram.com/language/ref/Locked.html}, note=[Accessed: 13-June-2026]}