is an attribute that prevents any values associated with a symbol from being modified.
Protected
is an attribute that prevents any values associated with a symbol from being modified.
Details
- Many built‐in Wolfram Language functions have the attribute Protected.
- SetOptions can be used on symbols with attribute Protected that do not also have the Locked attribute.
Examples
open all close allBasic Examples (2)
Scope (1)
Simultaneously protect and read protect the function f:
f[x_] := 2x + 1;
SetAttributes[f, {Protected, ReadProtected}]Attributes[f]Simultaneously clear both attributes:
ClearAttributes[f, {Protected, ReadProtected}]Attributes[f]Applications (1)
Properties & Relations (5)
Protecting a symbol is equivalent to setting the Protected attribute:
Protect[f];
SetAttributes[g, Protected];Attributes[{f, g}]Unprotecting a symbol is equivalent to clearing the Protected attribute:
Unprotect[f];
ClearAttributes[g, Protected];Attributes[{f, g}]No more definitions can be made for a protected symbol:
f[x_] := x ^ 3Protect[f];f[x_] := x ^ 2Neither can definitions be cleared:
Clear[f]To modify definitions of a protected symbol, unprotect it first:
f[x_] := x ^ 2;
Protect[f];f[x_] := x ^ 3Unprotect[f];f[x_] := x ^ 3SetOptions can be used the change the default options of a protected function:
Attributes[D]Change the options of D:
SetOptions[D, NonConstants -> {a, b, c}]SetOptions[D, NonConstants -> {}]A symbol that is locked and protected can no longer be changed:
Options[f] = {opt -> val};
f[x_] := x ^ 2;
SetAttributes[f, {Locked, Protected}]f[x_] := x ^ 3Unprotect[f];SetOptions[f, opt -> newVal]Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Protected, Wolfram Language function, https://reference.wolfram.com/language/ref/Protected.html.
CMS
Wolfram Language. 1988. "Protected." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Protected.html.
APA
Wolfram Language. (1988). Protected. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Protected.html
BibTeX
@misc{reference.wolfram_2026_protected, author="Wolfram Research", title="{Protected}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Protected.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_protected, organization={Wolfram Research}, title={Protected}, year={1988}, url={https://reference.wolfram.com/language/ref/Protected.html}, note=[Accessed: 12-June-2026]}