Modification of formulas without changing expression number

I made a
Original:

In[1]=a+b

In[2]=In[1]+3

…

If In[1] is modified to “a+b+2”, In[1] is changed to In[3].
So, I have to collect In[2] to In[3]+3.
All subsequent formulas have to be modified in the same way.
Is there any way to change only the content of the expression without changing the expression number?

Please check this note to know how to define your own function and change the parameter you need

Hi h r,

I’m not sure what you mean by “expression number”.

Are you trying to recursively define a function “In”, so that

In[i] depends on In[i-1] ?

Or are you trying to define a List “In”, so that

In[[i]] depends on In[[i-1]] ?

Note the syntax difference of single bracket “[” vs double bracket “[[”. The latter refers to Part, and is defined here: