# Symbol a is Protected even after ClearAll\["Global\`\*"\]

**URL:** <https://community.wolfram.com/t/symbol-a-is-protected-even-after-clearall-global/20562>\
**Category:** Questions\
**Created:** [August 17, 2022, 1:24pm UTC](https://community.wolfram.com/t/symbol-a-is-protected-even-after-clearall-global/20562 "2022-08-17T13:24:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hongyizhao](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@hongyizhao](https://community.wolfram.com/u/hongyizhao)\
**Post date:** [August 17, 2022, 1:24pm UTC](https://community.wolfram.com/t/symbol-a-is-protected-even-after-clearall-global/20562/1 "2022-08-17T13:24:25Z")

</div>

See my following code snippet:

```
In[197]:= ClearAll["Global`*"]
a = {{4, 16, 4}, {7, 25, 8}, {17, 63, 18}};
b = {{2, -2, -2}, {7, -71, 2}, {14, -114, 0}};
Last[HermiteDecomposition[a]] == Last[HermiteDecomposition[b]]
MatrixForm /@ {LatticeReduce[a], LatticeReduce[b]}

During evaluation of In[197]:= Set::wrsym: Symbol a is Protected.

During evaluation of In[197]:= Set::wrsym: Symbol b is Protected.

During evaluation of In[197]:= HermiteDecomposition::latm: Matrix contains an entry that is not rational.

During evaluation of In[197]:= HermiteDecomposition::latm: Matrix contains an entry that is not rational.

Out[200]= a == b

Out[201]= {\!\(\*
TagBox[
RowBox[{"LatticeReduce", "[", "a", "]"}],
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\), \!\(\*
TagBox[
RowBox[{"LatticeReduce", "[", "b", "]"}],
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\)}

```

As you can see, I’ve used the command **ClearAll[“Global`\*”]** at the beginninf of my code, but still the **Symbol a is Protected** problem is triggered. Any hints for fixing this problem?

Regards,  
Zhao

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [August 17, 2022, 2:00pm UTC](https://community.wolfram.com/t/symbol-a-is-protected-even-after-clearall-global/20562/2 "2022-08-17T14:00:14Z")

</div>

From the documentation for `ClearAll`:

> `ClearAll` does not affect symbols with the attributes `Locked` or `Protected`. »

You could `Unprotect` your variables or localize them. Or do not `Protect` symbols in the global context. Protecting them should indicate that you do not want to use them except in the protected way. That seems to be false in your situation.

If you’ve also locked the variables, then use different variables.

In my own workflows, I do not `ClearAll["Global`*"]` nor do I `Protect` symbols in the `Global` ` context. I also do not set single-letter variables to a value, except localized in `Module`, `Block`, `With`, or `Pattern` — or in scratch work in a Documentation notebook, since cell groups get a unique context in them. That’s all a matter of personal style, though, and probably idiosyncratic. Mostly they avoid mistakes I commonly make. One danger I live with is that when a new documentation page loads, it wipes out your scratch work, even if you go back (I suspect many people wouldn’t like that danger).

---

<div class="post-metadata">

**Author:** ![hansmilton](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/hansmilton/32/8656_2.png) [@hansmilton](https://community.wolfram.com/u/hansmilton)\
**Post date:** [August 17, 2022, 5:33pm UTC](https://community.wolfram.com/t/symbol-a-is-protected-even-after-clearall-global/20562/3 "2022-08-17T17:33:27Z")

</div>

From the [documentatio](https://reference.wolfram.com/language/ref/ClearAll.html?q=ClearAll)n of `ClearAll`:

 ![Unprotect.png](https://global.discourse-cdn.com/wolfram/original/2X/5/5ecd94703a3d518b4bd734211c89b902897acba4.png)
