# How to use With on previously defined expressions [duplicate]

The command With[{x = 1}, x] outputs 1.

The command t = x; With[{x = 1}, t] outputs x.

I expected this second input to give the same answer. How can I modify my code so it behaves in this way?

• To give you an idea: try t=x; With[{x=1}, {x, t}]. – J. M. will be back soon Nov 11 '15 at 14:05

I think you are confusing the behaviour of With and Block
t = x; Block[{x = 1}, t]

t = x; With[{x = 1}, Evaluate[t]]