WOLFRAM LANGUAGE MESSAGE

General::patop

DetailsDetails

  • This message is generated when a pattern based on Optional appears in an invalid location within another pattern expression.
  • A pattern based on Optional cannot be used as the first argument in PatternTest, Condition, Repeated, RepeatedNull, or Optional, or as the second argument in Pattern.
  • Optional[p,v] can also be entered using the notation .
  • Off[message] switches off the message; On[message] switches it on. For example: Off[General::patop].

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

An error occurs because an Optional pattern is used as the second argument in a Pattern expression:

In[1]:=
Click for copyable input
Out[1]=

This shows a valid use of an Optional pattern:

In[2]:=
Click for copyable input
Out[2]=