This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Tests  /

  • MemberQ[ list , form ] returns True if an element of list matches form, and False otherwise.
  • MemberQ[ list , form , levelspec ] tests all parts of list specified by levelspec.
  • form can be a pattern.
  • Example: MemberQ[ x^2, y^2 , x^_].
  • The first argument of MemberQ can have any head, not necessarily List.
  • See the Mathematica book: Section 1.8.5Section 2.3.5.
  • See also: FreeQ, Count, Cases, IntervalMemberQ.

    Further Examples

    The symbol a is clearly a member of the indicated list, but {a} is not.