Switch
Switch[e, case1, val1, case2, val2, ...]
attempts to match e
with the cases in order. If a match is found, returns the corresponding value.
Attributes[Switch] := {HoldRest, Protected, ReadProtected}
Simple examples
In[1]:= Switch[z, _, b, z, c] Out[1]= b
In[2]:= Switch[z, k_Symbol, k] Out[2]= k
In[3]:= Switch[z, 1] Out[3]= Switch[z, 1]
In[4]:= Switch[z, d, b, l, c] Out[4]= Switch[z, d, b, l, c]