Add Messages to Functions

You can set your own custom functions to issue messages where appropriate.

    
Define a function to issue a message and return unevaluated upon an error, which in this case occurs when the argument is not greater than or equal to zero:
In[11]:=
Click for copyable input
Define the message:
In[12]:=
Click for copyable input
In[13]:=
Click for copyable input
Out[13]=
In[14]:=
Click for copyable input
Out[14]=
New to Mathematica? Find your learning path »
Have a question? Ask support »