Wolfram Computation Meets Knowledge

EchoSet

Contributed by: Taliesin Beynon

Set a value to a symbol and print them.

ResourceFunction["EchoSet"][sym,value]

sets sym to value, while simultaneously printing “sym = value”.

Details and Options

EchoSet has the Attribute HoldFirst.

Examples

Basic Examples

Make an assignment:

In[1]:=
ResourceFunction["EchoSet"][x, 5]
Out[1]=

The value is stored:

In[2]:=
OwnValues[x]
Out[2]=

New assignments with identical sym overwrite old one:

In[3]:=
ResourceFunction["EchoSet"][x, 3]
Out[3]=

Make indexed assignments:

In[4]:=
ResourceFunction["EchoSet"][g[1], 4]; g[1] + 1
Out[4]=

rhs is evaluated:

In[5]:=
ResourceFunction["EchoSet"][y, Expand[(x + 1)^5]]
Out[5]=

Possible Issues

EchoSet does not thread over lists:

In[6]:=
ResourceFunction["EchoSet"][{x, y, z} = Range[3]]
Out[6]=

Resource History