NumberQ NumberQ[expr] returns True if expr is numeric, otherwise False. Attributes[NumberQ] := {Protected} Simple examples In[1]:= NumberQ[2] Out[1]= True In[2]:= NumberQ[2.2] Out[2]= True In[3]:= NumberQ[Rational[5, 2]] Out[3]= True In[4]:= NumberQ[Infinity] Out[4]= False In[5]:= NumberQ[Sqrt[2]] Out[5]= False In[6]:= NumberQ[randomvar] Out[6]= False In[7]:= NumberQ["hello"] Out[7]= False