Skip to main content

syntax - Substitution in parameters to "Which"


Why in this expression


In[1]:= a = 1;
b = 2;
f[x_] := Which[x < a, 10, a <= x < b, 20, True, 30]

f[x]

Out[4]= Which[x < 1, 10, a <= x < b, 20, True, 30]

the values of a and b are substituted only in the first parameter to Which and not in the third?


I am using Mathematica 8 on OSX.




Comments