Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

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[1]:=
Click for copyable input
Define the message:
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=