Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Defining Variables and Functions > Attributes > Protect >

Protect

Protect
sets the attribute Protected for the symbols .
Protect
protects all symbols whose names match any of the string patterns .
  • Protect allows abbreviated string patterns containing the following metacharacters:
*zero or more characters
@one or more characters, excluding uppercase letters
\\*, etc.literal *, etc.
  • Protect protects all symbols in a particular context.
Define and protect a function:
The function definition can no longer be changed:
Define and protect a function:
In[1]:=
Click for copyable input
The function definition can no longer be changed:
In[2]:=
Click for copyable input
Out[2]=
Protect several symbols:
Protect all symbols matching a string pattern:
Protect all symbols in the current context:
Protecting a symbol is equivalent to setting the Protected attribute:
Protect returns the list of symbols actually protected:
If a symbol is already protected, it is not protected again:
No more definitions can be made for a protected symbol:
To protect all symbols given in a variable, use Evaluate:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF