This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Programming / Assignments /

Further Examples: Set (=)

When you make an assignment with the Set (or =) operator, the right-hand side is evaluated immediately.

In[1]:=

Out[1]=

on the other hand, with SetDelayed the evaluation is postponed until zzz is evaluated, so no output is generated.

In[2]:=

The difference between yyy and zzz is not apparent until x is set to a symbolic expression.

In[3]:=

Out[3]=

In[4]:=

Out[4]=

In[5]:=

Out[5]=

In[6]:=

Out[6]=

In[7]:=

Out[7]=

This defines the function ff.

In[8]:=

In[9]:=

Out[9]=

In[10]:=