# How to assign (and retrieve) variables with subscripts? [duplicate]

I like to give subscripts to my variable names when the variables are related. I.e.,

Subscript[r, i] = 3


3

A problem arises when I later assign r to a value and want to use Subscript[r,i] again.

r = 6


6

Subscript[r, i]


Subscript[6, i]

Is there any way for me to get the value I assigned to Subscript[r,i]? Is this the wrong way to use Mathematica?

-

## marked as duplicate by Yves Klett, Sjoerd C. de Vries, Michael E2, Mike Honeychurch, István ZacharOct 16 '13 at 7:57

Please read the documentation for Notations and Symbolize – Mike Honeychurch Oct 15 '13 at 21:20