- #1
guerom00
- 93
- 0
Hello all,
There's something I don't understand when using Return[]…
Take this input :
f := Function[{x}, (If[x > 5, Return[a]]; x + 3)];
g[x_] := (If[x > 5, Return[a]]; x + 3);
and this output :
In[25]:= f[6]
g[6]
Out[25]= Return[a]
Out[26]= a
In one case, it returns the value "a", as expected. But in the other case, it writes explicitly "Return[a]". Why ? I don't understand...
Thanks in advance.
There's something I don't understand when using Return[]…
Take this input :
f := Function[{x}, (If[x > 5, Return[a]]; x + 3)];
g[x_] := (If[x > 5, Return[a]]; x + 3);
and this output :
In[25]:= f[6]
g[6]
Out[25]= Return[a]
Out[26]= a
In one case, it returns the value "a", as expected. But in the other case, it writes explicitly "Return[a]". Why ? I don't understand...
Thanks in advance.