Skip to content

With

With[{s1=v1, s2=v2, ...}, body] locally replaces the specified symbols in body with their respective values.

Attributes[With] := {HoldAll, Protected}

Simple examples

In[1]:= With[{x = 2}, {x, 3*x}]
Out[1]= {2, 6}
In[2]:= With[{x := 2, y := 3}, {x, 3*y}]
Out[2]= {2, 9}