KeyExistsQ

KeyExistsQ[assoc,key]

returns True if the specified key exists in the association assoc, and False otherwise.

KeyExistsQ[key]

represents an operator form of KeyExistsQ that can be applied to an expression.

Details

Examples

Basic Examples  (2)

Test if a key exists in an association:

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

Test if a key exists in a list of rules:

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

See Also

Lookup  Keys  MemberQ  FreeQ  Missing

Introduced in 2014
(10.0)