Mathematica 9 is now available

Message

Usage

Message[symbol::tag] 用来在信息 symbol::tag 未被切断时输出该信息 .
Message[symbol::tag,  ,  , ... ]用来输出一条信息, 并按需要插入  的值.


Notes

Message在通道$Messages上生成输出.
• 你可以使用Off[symbol::tag]来切断一条信息.,而使用接通一条信息.
• 在任意两个连续输入行之间,Mathematica最多能输出一条具有特定名称的信息三次.在最后场合,它输出General::stop信息.
• 在对特定输入行进行计算期间,与那个输入行相联系的信息名被添加到使用HoldForm包装的列表$MessageList中.在第n个输入行末端,$MessageList的值被赋给MessageList[n].
Message[mname,  ,  , ... ]StringForm[mess,  ,  , ... ] 形式输出,其中 mess 信息 mname的值. 字符串 mess 中形如`i` 的入口使用相应的  替换.
• 当给定由symbol::tag指定的一条信息时, Message 首先在$Language列表中搜索每一种语言的信息symbol::tag:: . 若无法找到这些信息中任意一种,它便搜索确切的信息 symbol::tag. 若没找到,它将对General::tag进行同样的搜索过程. 若仍没找到任何信息, 它会把全局变量 $NewMessage 的任何给定值应用到 symbol"tag"上.
• 如果你使用symbol::tag::lang来指定一条信息, 则 Message 将只搜索具有特定语言lang的信息.
• 参见 Mathematica 全书: 2.8.21节.
• 同时参见: Print, CellPrint, Write, On, Off, Check, MessageList.
Further Examples

You can mimic all aspects of the way in which built-in Mathematica functions generate messages with Message. You can for example switch on and off messages using On and Off and Message will automatically look for General::tag if it does not find the specific message s::tag

This defines the text of a message associated with f.

In[1]:=  

Out[1]=

Here is the function f.

In[2]:=  

When the argument of f is greater than 10, the message is generated.

In[3]:=  

Out[3]=

This switches off the message.

In[4]:=  

Now the message is no longer generated.

In[5]:=  

Out[5]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.