Return

Return[x] returns x immediately.

Attributes[Return] := {Protected}

Simple examples

In[1]:= CompoundExpression[myreturnfunc := CompoundExpression[Return[x], hello], myreturnfunc]
Out[1]= x
In[2]:= CompoundExpression[ret[x_] := CompoundExpression[Return[x], hello], ret[3]]
Out[2]= 3
In[3]:= CompoundExpression[myfoo := CompoundExpression[i = 1, While[(i) < (5), CompoundExpression[If[i === 3, Return[i]], i = i + 1]]], myfoo]
Out[3]= 3
In[4]:= Return[3]
Out[4]= Return[3]
In[5]:= CompoundExpression[retother := CompoundExpression[Return[], hello], retother]
Out[5]= Null