# Variable assignment using Subscript

**URL:** <https://community.wolfram.com/t/variable-assignment-using-subscript/23866>\
**Category:** Questions\
**Created:** [April 14, 2024, 4:42pm UTC](https://community.wolfram.com/t/variable-assignment-using-subscript/23866 "2024-04-14T16:42:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shengdai1](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@shengdai1](https://community.wolfram.com/u/shengdai1)\
**Post date:** [April 14, 2024, 4:42pm UTC](https://community.wolfram.com/t/variable-assignment-using-subscript/23866/1 "2024-04-14T16:42:54Z")

</div>

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/10561cbd-f52a-4a09-bd60-8e55d219b7e4)

---

<div class="post-metadata">

**Author:** ![eric3](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/eric3/32/12760_2.png) [@eric3](https://community.wolfram.com/u/eric3)\
**Post date:** [April 15, 2024, 1:06am UTC](https://community.wolfram.com/t/variable-assignment-using-subscript/23866/2 "2024-04-15T01:06:53Z")

</div>

An expression like

```
exampleVariable=10 

```

does not really set the value of a variable. It creates a replacement rule. That distinction can usually be ignored, but it becomes important when you do

```
Subscript[example, Variable]=10

```

What you’re doing here is creating a replacement rule that is attached to the symbol `Subsript`.

I’m not really sure what your question is or what you’re trying to accomplish, so I don’t know what else to say.

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [April 15, 2024, 3:53pm UTC](https://community.wolfram.com/t/variable-assignment-using-subscript/23866/3 "2024-04-15T15:53:06Z")

</div>

You may try `TagSet` or `TagSetDelayed`:

```
example /: Subscript[example, variable] = 10

```

This way `example` will change color to black, because the assignment will be tied to `example`, not to `Subscript`.
